plasmo
plasmo copied to clipboard
[BUG] Uncaught Error: Extension context invalidated.
What happened?
A bug happened! So many errors. I don't know why.
background.ts
import browser from 'webextension-polyfill'
browser.contextMenus.removeAll();
browser.contextMenus.create({
id: 'test',
title: "test",
contexts: [
"image",
]
});
browser.contextMenus.onClicked.addListener(function(info, tab) {
// TODO
browser.tabs.sendMessage(tab.id, {...});
});
content.ts
import browser from 'webextension-polyfill'
browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
// Do some thing with promise.
fetch('/api').then((res) => {
// TODO
}).catch();
return true;
});
errors in file content.480c00a3.js:328
Version
Latest
What OS are you seeing the problem on?
No response
What browsers are you seeing the problem on?
No response
Relevant log output
No response
(OPTIONAL) Contribution
- [ ] I would like to fix this BUG via a PR
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate problems.
I faced the same issue while add content script. I followed everything written in documentation and still get the error :
Basically, I just added a console.log to check if the script is getting loaded or not. But, here is the hack. The script loads successfully its just that I was looking into the wrong console.
When you load the script, all the updates will be visible in Tabs Console not in the Extension's Console. Please check the Tabs console. I have just ignored the error. Everything is working fine.
the same issue +1
the same issue +1
the same issue +1
same