The issue you are facing is most likely a mishandled asynchronous response to the runtime.sendMessage.
To send the asynchronous response, there are two options as follows:
· To return true from the event listener. This keeps your sendResponse function valid after the listener returns, so you can call it later also.
· To return a Promise from the event listener, and resolve when you have your response or it can also reject it in case of the error.
When you try to send an async response however fail to use either of these mechanisms, the supplied sendResponse argument to sendMessage goes out of the scope and the result comes up exactly as the error message shown to you: your message port the message-passing apparatus is closed before the response was received.
So the bottom line is, if you ever see your extensions causing these errors just inspect closely all of your onMessage listeners. Some of them must need to start returning promises so marking them as asynchronous will be enough.