. Advertisement .
..3..
. Advertisement .
..4..
“Unchecked runtime.lastError: The message port closed before a response was received” is a common error that shows up in many ways. What is the cause of it and how to solve it? In this article we will give you some solutions to solve this problem. Read on it.
How Does The Error “Unchecked runtime.lastError: The message port closed before a response was received” Occur?
When you are attempting to run your laravel project, you easily get the following warning message in your chrome browser:
Unchecked runtime.lastError: The message port closed before a response was received
The warning message, “Unchecked runtime.lastError: The message port closed before a response was received” occurs due to the browser extensions. When your extension may have been corrupted or you are using an extension that is not supported; you will get this error. If a custom extension is being developed, then there may be a problem with the extension code.
How To Solve The Error “Unchecked runtime.lastError: The message port closed before a response was received”?
Method 1: Disable all Extension
Different Chrome extensions frequently cause the error “Unchecked runtime.lastError: The message port closed before a response was received”; thus, all you have to do to fix it is to disable all chrome extensions and restart your project.
Open Chrome:/extensions first, and then attempt to disable all extensions. You can also disable the specific extensions that cause this issue by checking them one by one.
Method 2: Add a return statement
Please check the code snippet for the onMessage listener in your extension code. The above error message may appear if this listener does not appropriately return the response.
To fix the issue, you have to add return true to the onMessage call listener as shown below:
chrome.runtime.onMessage.addListener(function(rq, sender, sendResponse)
{
setTimeout(function() {
sendResponse({status: true});
}, 1);
return true; // Return true should be added to solve the error.
});
Method 3: Try Different Browser
Programs called Google Chrome extensions can be set up in Chrome to modify the browser’s features. Google Chrome extensions contain improving Chrome with new features or changing the program’s current behavior to make it more user-friendly and advantageous for users.
You can switch to another browser, such as Opera, Firefox, etc. if you get this error with the Chrome browser. As mentioned in the first solution, this problem is caused by an extension. You can either disable all extensions or switch browsers to solve the error. After doing that, you can quickly resolve your problem.
Three solutions mentioned above are very simple but they work efficiently for you. They will help you resolve your problem and make your program will run well without any errors. So, let’s apply them to get your desired results.
Conclusion
We hope you enjoy our article about the error “Unchecked runtime.lastError: The message port closed before a response was received“. With this knowledge, we know that you can fix your error quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Read more
Leave a comment