klippy
klippy

Reputation: 243

TypeError: Cannot read property 'sync' of undefined. How do I solve this?

I am trying to follow the tutorial here - https://developer.chrome.com/extensions/getstarted

But I keep getting the following error when I'm trying to build my extension:

TypeError: Cannot read property 'sync' of undefined

Here is my manifest file:

{
    "name": "Getting Started Example",
    "version": "1.0",
    "description": "Build an Extension!",
    "permissions": ["storage"],
    "background": {
      "scripts": ["background.js"],
      "persistent": false
    },
    "manifest_version": 2
}

I have "permissions": ["storage"] included

Upvotes: 1

Views: 5227

Answers (4)

simonlbn
simonlbn

Reputation: 51

I ran into this today. It seems if you get an error, it's not cleared even if you reload the extension - you have to explicitly clear the error seperately.

In chrome://extensions/ clicking on the extension in questions "Errors" button and then the "Clear all" button fixed the problem for me.

Upvotes: 5

Muaddip
Muaddip

Reputation: 31

If the error does not disappear after you have declared "storage" in the manifest, and also reloaded the extension. In this case, uninstall the extension and install it again. The error will disappear. Browsers are also buggy.

Upvotes: 3

bde-maze
bde-maze

Reputation: 329

Make sure to Reload your extension in the extension Manager. Check the picture bellow:

enter image description here

Upvotes: 0

Toke Raabjerg
Toke Raabjerg

Reputation: 56

If you're attempting to access the chrome.storage API from the console, you must select the chrome extension (like shown below). Hope it's any help.

Chrome Console extension context

Upvotes: 2

Related Questions