3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

chrome拡張のmanifestをv3に更新したら "Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist." エラーが出た場合の直し方

Posted at

結論

sendMessage 系が promise を返すようになってるので、ちゃんとエラーハンドリングしましょう

let promise = chrome.tabs.sendMessage(tabs[0].id, msg);
promise.catch((error) => {
    //console.log(error);
});

もしくはこう

chrome.tabs.sendMessage(tabs[0].id, msg).catch((error) => {
    //console.log(error);
});

サンプルなどでは省略されがちなのでなかなか気づけなかった

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?