What exactly invalidates the context?
When testing my extension, I noticed that it was often showing me the "Context Invalidated, Press to Reload" tooltip in the bottom right of the screen. In the dev tools, I can see the "Script Runtime - reloading" message too. The problem is that this happens even when I don't update any file in my project.
I don't see any update in my terminal neither.
This is something new, so it must be something I've done, but I can't figure out why. Is there a way to tell more precisely what invalidated the context?
18 Replies
Bing Chat responded:
In a Chrome extension, a context refers to the environment in which the extension is running. An extension context can be invalidated when the extension is reloaded on the chrome://extensions
page but the web tab(s) are not reloaded⁴. This error can also occur when an extension doesn't handle its "orphaned" content script after the extension is auto-updated by the browser¹.
Is there anything else you would like to know?
Source: Conversation with Bing, 6/2/2023
(1) Uncaught Error: Extension context invalidated when calling chrome .... https://stackoverflow.com/questions/61809597/uncaught-error-extension-context-invalidated-when-calling-chrome-storage-local.
(2) javascript - Error: Extension context invalidated, from chrome .... https://stackoverflow.com/questions/75073088/error-extension-context-invalidated-from-chrome-extension-haldlgldplgnggkjaa.
(3) Extension context invalidated. Chrome Extension - Stack Overflow. https://stackoverflow.com/questions/55224914/extension-context-invalidated-chrome-extension.
(4) Chrome Extension: Extension context invalidated when getting URL. https://stackoverflow.com/questions/63521378/chrome-extension-extension-context-invalidated-when-getting-url.
(5) Google Chrome: "Extension context invalidated" error - GoTo Community. https://community.logmein.com/t5/LastPass-Support-Discussions/Google-Chrome-quot-Extension-context-invalidated-quot-error/td-p/247500.
Stack Overflow
Uncaught Error: Extension context invalidated when calling chrome.s...
can you help me again with this problem? I am getting error Uncaught Error: Extension context invalidated. in chrome://extensions.
I am trying to make a timer that whenever you we're idle let's sa...
Stack Overflow
Error: Extension context invalidated, from chrome-extension://haldl...
According to Sentry, our react application has reported this error 700 times in the last 24 hours, from 2 users:
Error: Extension context invalidated.
at Object._updateMetadata(chrome-extension://
Stack Overflow
Extension context invalidated. Chrome Extension
I am using Chrome Extension in development mode and go to the chrome://extensions page. Here I press the Reload button and try to continue using the Extension, but I see the message:
Extension c...
Stack Overflow
Chrome Extension: Extension context invalidated when getting URL
I'm retrieving some images from one of my chrome extension folders to the website DOM and everytime I reload the extension I'm getting a 'Extension Context Invalidated' error. Same thing happens wh...
I checked out those links, but I can't figure out where this problem is coming from. There is no error message coming from my app, and the only thing I see in the console is this:
Plasmo seems to be triggering this.
So this is a new policy in the latest chrome update, they reduced the idle time for bgsw to 30s (since chrome 110 or so)
try upgrade the framework and see if it's still happenning
I'll try and report back, thanks!
@louisgv It seems like my ext's context randomly invalidates after a certain period
I'm in Plasmo 0.74.2
is this in chrome or in firefox?
Edge
chrome latest update makes the invalidation windows much shorter :d
can you check the generated background.js to see if it has the keepAlive funciton
Doesn't exist
hmm....
I'm juggling 3 other bugs atm
will take a look at this later
also have a flight tmr
xD
oh damn
I guess I'll stop developing until weekend 🙃
wanna try using a local plasmo setup and debug it :d
Sadly I need to focus on uni studies, don't wanna lag behind
Should it be reported to https://bugs.chromium.org/p/chromium/issues/wizard ?
it's a deliberate update tho xD...
intentional, not a bug
Yet still, in the Google keynote it was announced that the 5-minute lifespan will be dropped 🙂
perhaps they dropped it in favor of a 30s lifespan instead lol: https://developer.chrome.com/docs/extensions/mv3/service_workers/service-worker-lifecycle/#idle-shutdown
Well that's one heck of a roller coaster
Initially they set it at 5m, at Google I/O they announced that it's indefinite and now it's 30s
SIdenote, is a solution in progress?