2

I'm trying to get cookies from my Chrome extension when the app is loading:

chrome.cookies.getAll({ "url": config.cookie.cookieUrl }, function (cookies) {
            if (callback) callback(cookies);
        });

Sometimes I get the error:

Error during cookies.getAll: No accessible cookie store found for the current execution context.

These posts didn't help me:

  1. Stackoverflow discussion

  2. Google discussion

1
  • So the issue happens only during the first seconds when Chrome is starting up?
    – wOxxOm
    Oct 22, 2015 at 9:12

1 Answer 1

0

I recently stumbled upon this issue as well and it looks like it's far from being resolved by the chromium project: https://bugs.chromium.org/p/chromium/issues/detail?id=113994

The solution I found to work is checking first if there's a cookie store available:

    function isCookieStoreAvailable() {
        return new Promise(function (resolve, reject) {
            chrome.cookies.getAllCookieStores(function (cookieStores) {                
                if (cookieStores.length) {
                    resolve();
                } else {
                    reject();
                }
            });
        });
    }

Then retrying several times until it becomes available.

Another thing I did was to reload the extension after 10 seconds of retrying but that's only as a last resort:

chrome.runtime.reload()

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.