DEV Community

TechFixDocs
TechFixDocs

Posted on • Originally published at techfixdocs.my.id

How to Fix: Port error: Could not establish connection. Receiving end does not exist. In Chromiume

Check the port number in your manifest.json file and ensure it is not conflicting with another extension or process.

The Problem

The 'Port error: Could not establish connection. Receiving end does not exist' error in Chromium occurs when the extension is unable to establish a connection with the receiving end.This issue affects developers who are using Chrome as their browser and have an extension that relies on sending requests to the background script.
⚠️ Common Causes

                The primary reason for this error is due to the fact that the `chrome.extension.onRequest` listener is not properly configured. The listener expects a request object with a specific structure, but in your case, you are only passing a callback function.Another possible cause could be related to the manifest.json file not being correctly formatted or missing required fields.

            🚀 How to Resolve This Issue

                Verify and correct the `chrome.extension.onRequest` listener configuration

                    Step 1: Check that the request object passed to the listener has the correct structure, including a `req` property with the requested command.Step 2: Make sure that the callback function is properly defined and matches the expected signature.Step 3: Test the listener with a simple request to ensure it's working correctly.



                Check manifest.json file for errors or missing fields

                    Step 1: Verify that the `manifest.json` file contains all required fields, including the correct `background` and `content_scripts` sections.Step 2: Check for any syntax errors in the JSON file.Step 3: Test the extension with a simple request to ensure it's working correctly.


            🎯 Final Words
            To resolve this issue, you need to verify and correct the `chrome.extension.onRequest` listener configuration and check your manifest.json file for errors or missing fields. By following these steps, you should be able to establish a connection with the receiving end and fix the 'Port error: Could not establish connection. Receiving end does not exist' issue.
Enter fullscreen mode Exit fullscreen mode

Full step-by-step guide with screenshots: Read the complete fix here

Found this helpful? Check out more verified tech fixes at TechFixDocs

Top comments (0)