27

Chrome DevTools has a handy inspector for Local Storage and Session Storage, but is there nothing to inspect chrome.storage.sync?

enter image description here

chrome://sync-internals/ doesn't seem to display the actual contents of the synchronized storage per extension.

wOxxOm
  • 65,848
  • 11
  • 132
  • 136
Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404

3 Answers3

27

[Update 2023]

For a native way of doing it without installing anything, check the other answers.


Storage Area Explorer extension provides a UI for viewing, editing, clearing, importing and exporting of chrome.storage.local, chrome.storage.sync, localStorage and sessionStorage.

In the future this feature may be implemented natively: https://crbug.com/848752.

Warning for ManifestV3: since devtools for service worker doesn't show storage, you'll have to open any visible page of your extension like the popup or options, right-click the page, then click "inspect", then go to Storage Explorer. If your extension doesn't have any visible pages, you can open chrome-extension://ID/manifest.json where ID is the id of the extension as shown in chrome://extensions page. Another method is to right-click any script from your extension in devtools (when you inspect the content script or service worker), then click "Open in a new tab". You can add a bookmark for this tab to open it quickly next time.

screenshot

marcelocra
  • 2,094
  • 2
  • 24
  • 37
wOxxOm
  • 65,848
  • 11
  • 132
  • 136
  • Doesn't work for me. In my case, I only see window.sessionStorage and window.localStorage. But I wanted my chrome.storage.sync data. I also couldn't find any options for adding it. – aderchox Jul 20 '22 at 16:33
  • It shows the data for the current URL origin so you need to use it in devtools of the extension page. – wOxxOm Jul 20 '22 at 17:17
  • May I ask what you mean by "the extension page"? When I click on the blue "service worker" in the "chrome://extensions/" and then choose "Storage Explorer" tab it says it's disabled on normal pages or extensions without storage permission (while mine does have the storage permission). Or maybe you mean the devtools I get from the popup? That one _works_, but still as soon as a new tab is opened it's gone because the popup gets closed automatically when a new tab is opened. I hope you know what I mean(?). So the "the extension page" you mentioned is something else and hopefully more convenient? – aderchox Jul 20 '22 at 17:35
  • 2
    Service worker isn't a page. I mean any visible page of the extension. If it doesn't have any, you can open chrome-extension://ID/manifest.json where ID is the id of the extension. – wOxxOm Jul 20 '22 at 19:04
  • Yeah I still haven't added more than background.js file. But the address you said works great, thanks! The real issue I have with chrome.storage is I have some global variables in background.js and they get reset. So I wonder what's the behavior, could background.js run multiple times? – aderchox Jul 20 '22 at 19:33
  • 1
    See https://developer.chrome.com/docs/extensions/mv3/migrating_to_service_workers/ – wOxxOm Jul 20 '22 at 21:29
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/246639/discussion-between-aderchox-and-woxxom). – aderchox Jul 21 '22 at 08:51
  • 1
    For posterity's sake, I was able to get this working by right-clicking my extension icon in the Chrome toolbar, and clicking on "Inspect Popup", then accessing the explorer from that developer tools context. – Clement Hoang Dec 15 '22 at 06:06
15
  1. Visit chrome://sync-internals/
  2. Click Sync Node Browser tab and wait for it to load (may give a blank screen or in progress cursor)
  3. Click expansion triangle in the sidebar for Extension settings
  4. Click on individual settings in the sidebar to see their values and other metadata

screenshot of Sync Internals page

Nick McCurdy
  • 17,658
  • 5
  • 50
  • 82
14

A poor workaround is to call get and obtain all the stored values. Of course, this doesn't let you conveniently edit them:

chrome.storage.sync.get(null, function callback(items) { console.log(items) });

For ManifestV3 in modern Chrome:

await chrome.storage.session.get()
wOxxOm
  • 65,848
  • 11
  • 132
  • 136
Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404