crx-bridge icon indicating copy to clipboard operation
crx-bridge copied to clipboard

Unable to detect runtime context i.e crx-bridge can't figure out what to do

Open vassiliskrikonis opened this issue 3 years ago • 2 comments

In my MV3 extension, I've tried to send a dummy message from a content script to the background service worker and I get the following error from the extension

Uncaught Error: Unable to detect runtime context i.e crx-bridge can't figure out what to do

which seems to me that it can't even find the background "namespace". I'm not using the "window" so wouldn't that work out of the box?

P.S Thanks for this excellent package!

vassiliskrikonis avatar Nov 08 '21 00:11 vassiliskrikonis

Workers of any kind are not supported at this point.

Load crx-bridge in the background script as usual, then leverage v-thread to create the workers. Proxy the function calls through it.

v-thread is not a popular package. Perhaps workers itself are not as common as I think they are, or I just didn't use proper keywords. But if you spot any problems or questions, do create the issue in the repo.

zikaari avatar Nov 10 '21 19:11 zikaari

Perhaps I didn't explain the issue clearly (or I don't understand the reply). I get the error just by loading the background service worker. I don't want to create any workers there.

In chrome extensions with Manifest Version 3 (MV3), the background script is replaced by a background service worker.

vassiliskrikonis avatar Nov 12 '21 17:11 vassiliskrikonis

same issue

delai avatar Mar 12 '23 06:03 delai

This should be fixed in [email protected], the successor to crx-bridge

zikaari avatar Apr 06 '23 20:04 zikaari