How to fix Unchecked runtime lastError Could not establish connection Receiving end does not exist

0 votes

Whenever I load any page of my node application I am getting this error:

Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist

Does someone have any idea on this issue? I want to know how to overcome this issue.

May 12, 2022 in Node-js by Kichu
• 19,040 points
7,323 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

What you have to do is to handle window.chrome.runtime.lastError in the runtime.sendMessage callback. Just use this code and it will handle that error.

window.chrome.runtime.sendMessage(
      EXTENSION_ID,
      { message:"---" }, // jsonable message
      (result) => {
        if (!window.chrome.runtime.lastError) {
           // message processing code goes here
        } else {
          // error handling code goes here
        }
      }
    );
  });

I hope this helps you.

answered May 13, 2022 by narikkadan
• 86,360 points

edited Mar 5, 2025

Related Questions In Node-js

0 votes
1 answer

How to create a directory if it doesn't exist using Node.js?

Hello @kartik, Try: var fs = require('fs'); var dir = ...READ MORE

answered Jul 9, 2020 in Node-js by Niroj
• 82,800 points
7,404 views
0 votes
1 answer

How to clean node_modules folder of packages that are not in package.json?

Hello @kartik, You could remove your node_modules/ folder ...READ MORE

answered Jul 13, 2020 in Node-js by Niroj
• 82,800 points