0

I am pretty new to the concept of developing a chrome extension , and I am facing this issue since last 1-2 days and I am not able to solve it.

I have tried every possible method mentioned over the Internet but I am not able to get rid of this issue.

Here , is the piece of code where I am incurring this issue :

chrome.runtime.onMessage.addListener(async (msg, sender, response) => {
  //Listening for different Kind of message Events to and from the Extenstion to the Database :
  if (msg.command == "fetchNotes") {
    //Processing the Request then after listening to the request
    firebase
      .database()
      .ref("/notes")
      .once("value")
      .then(function (snapshot) {
        response({
          type: "result",
          status: "success",
          data: snapshot.val(),
          request: msg,
        });
      });

    
  }
  return true ;
});

The error which , I am getting is this :

"Unchecked runtime.lastError: The message port closed before a response was received."

0 Answers0