Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Opened this issue ยท 8 comments
I'm trying to post message from web to content scripts, but for some reason it keeps showing error Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Here is my content script (index.ts):
const handleDOMLoaded = async () => {
import("./content");
};
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", handleDOMLoaded);
} else {
handleDOMLoaded();
}
content.ts:
import { allowWindowMessaging } from "webext-bridge/content-script";
allowWindowMessaging("test");
I have no idea why it causes that, it just happens whenever I call the allowWindowMessaging
function.
I also have this problem.
Can you try not importing asynchronously? It might have something to do with that
@songpengyuan Can you also share your setup?
Can you try not importing asynchronously? It might have something to do with that
@songpengyuan Can you also share your setup?
I can't import webext-bridge without import another file asynchronously.
@hoangvu12 Hello, have you resolved this issue?
@hoangvu12 Hello, have you resolved this issue?
@hoangvu12 Hello, have you resolved this issue?
I ended up writing my own messaging bridge ๐
Hmm, I put a message in my background script as well, but it didn't solve the issue. Looks like I'm off to do #67 (comment). :)