I'm currently stumped on a problem where the content script will send a message before the service worker becomes ready after being inactive for a while.
The error message is "The message port closed before a response was received."
There are actually 3 windows opened to replicate it.
- chrome://serviceworker-internals/
- chrome://extensions/ (with Service worker inactive)
- Tab where the content script containing a button that will send a message to service worker.
When i press the button to send message from content script to service worker, the "running status" of the service worker in chrome://serviceworker-internals/ was still "starting" before it eventually goes to "running".
It seems like the message is sent before the status is completely running.
Is there any way to handle this type of scenario?