What caused the “Unchecked runtime.lastError: The message port closed before a response was received.” warning?

You can’t return a Promise to make the function async, you have to return true. So change this:

return Promise.resolve("");

To this:

Promise.resolve("").then(result => sendResponse(result));
return true;

Leave a Comment