Uncaught Error: Extension context invalidated.

Hi, I'm getting the following error:

Uncaught Error: Extension context invalidated.


And I'm sending messages when an
iconEle
is clicked from
content.ts
to
background.ts
like this:

content.ts

iconEle.addEventListener('click', () => {
      chrome.runtime.sendMessage({ type: 'iconClicked' })
  });


background.ts

chrome.runtime.onMessage.addListener((message) => {
  if (message.type === 'iconClicked') {
    chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
      chrome.tabs.sendMessage(tabs[0].id, { ...message });

    });
  }
});

So, for any reason after a while, I get the error on the screenshot.

Seems, that is something related to
chrome.runtime.sendMessage
. Maybe, someone is familiar with this error. Any idea?
image.png
Was this page helpful?