Question: I'm trying to use chrome storage in an extension, via a content\_script, but I keep failing on 

```
Uncaught TypeError: Cannot read property 'sync' of undefined 

```

This is my code:

```
testChromeStorage();

function testChromeStorage() {  
    console.log("Saving");
    chrome.storage.sync.set({'value': theValue}, function() {
        message('Settings saved');
    });
    chrome.storage.sync.get("value", function (retVal) {
            console.log("Got it? " + retVal.value);
    });
}

```

Answer: 
**RELOAD THE EXTENSION**

I had the "permissions" key added in my `manifest` file but still I struggled to get this fixed.

After adding the permission:-

```
"permissions": [
    "storage"
 ]

```

Goto your extension using: chrome://extensions/ & click the Reload button:-

[![enter image description here](https://i.stack.imgur.com/n2b1a.png)](https://i.stack.imgur.com/n2b1a.png)
**RESTART THE DEV SERVER**

Despite adding the permission and reloading the extension, I sync was still undefined.

Turned out I needed to restart the dev server for the new manifest to picked up.
Which makes sense since this file was not being watched.
Doh!