-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in console: Uncaught (in promise) #806
Comments
there is also an open question on stackoverflow about this error: |
I get it too with a fresh installation of Ghostery on Chromium.
|
Can also be reproduced on the Ghostery homepage (https://www.ghostery.com), so it is not caused by any of the scripts on the Google search page. From the Stackoverflow post, it might have started in Chrome 102 or 103. Most likely it comes from the adblocker when it injects its code through content_script into the main page. Somewhere we are not properly handling all errors. I don't think it will affect functionality for average users, but it can be annoying for frontend developers. Unfortunately, it is not straightforward to figure out where the error handling is missing. But error messages share that common part; at least that is a start:
|
I first encountered this error on my ad-free project with the Ghostery extension enabled. |
My feeling is that the code that is triggering it, is in the adblocker. Based on the observation that |
Can confirm that the issue comes from ghostery. |
Ghostery uses the webextension-polyfill library, where the issue is also discussed: The discussion in the issues has more information, but in a nutshell, it looks like the fix from the library will be to detect Chrome's error message and treat it as a success: |
Nevertheless, the bug is also on our site, as it should not happen, that Promise is kept in a limbo state. |
from the webextension-polyfill (and removes the minified file). The patch silences the following warning that started to appear in recent Chrome versions: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received refs ghostery#806
From what I can tell, the functionality is not affected (e.g. the communication between the adblocker's content script and the background). Unless I'm missing something, silencing the warning (as they are discussing in the webextension-polyfill) looks like a solution. To try it out, I created #830 which applies the open pull request. |
@philipp-classen That's the doctor's programming. Treat the symptoms, not the decease 😉 Do we yet not know what causes these symptoms? |
@philipp-classen As the polyfill hides the message, it does not solve the issue, and the message is there not without reason. One of the reasons is fixed here: ghostery/adblocker#2724 (and I even tried hard to make the flow the same). |
* Apply patch mozilla/webextension-polyfill#385 from the webextension-polyfill (and removes the minified file). The patch silences the following warning that started to appear in recent Chrome versions: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received refs #806 * Added CHANGELOG
To explain the reasoning behind merging #830: For parts like the adblocker, Ghostery needs to communicate between the background (the extension) and the content script (the website). Firefox and Chrome have similar APIs, but with a different interface - Firefox is promise-based, while Chrome uses callbacks (in Manifest V2). For that reason, we are using the webextension-polyfill library, which enables us to have a Firefox-like API on Chrome. As part of their implementation, the polyfill library detected a specific error message from Chrome without showing a warning. In the context of Ghostery that can be seen as a implementation detail, as long as the communication between content script and background works as in Firefox. Now Chrome recently changed its code and the original error message was changed and split into two different message. That is why suppressing the warning inside the library no longer works. The fix that is being discussed in mozilla/webextension-polyfill#384 is to update the detection code to cover the new text of the error messages. It is not merged (waiting for test coverage), but it solves the problem already in Ghostery and I could not find negative side-effects while testing it. If it gets officially merged and released, we can upgrade the library and drop the npm-patch, of course. |
If there are reproducible bugs related to it, please feel free to report them. Especially, if blocking works in Firefox but breaks in Chrome. What I'm aware of is that we currently do not reliably block YouTube ads on Chrome. We are working on a fix for that, but so far I cannot see that it is related to the warning (instead it is a race). The fix will affect the mechanism that the adblocker engine uses to inject scriptlets (replacing message passing by injecting via tabs.executeScript. |
That should allows us to remove the patch ghostery/ghostery-extension#830 refs ghostery/ghostery-extension#806
That should allows us to remove the patch ghostery/ghostery-extension#830 refs ghostery/ghostery-extension#806
Hello I confirm the bug on
|
Thank you for the confirmation @sarcadass |
Also worth mentioning that on Opera and Edge, which are Chromium-based browsers, we already released the fix (part of https://github.com/ghostery/ghostery-extension/releases/tag/v8.9.1). There the error message should no longer appear. For Edge/Opera/Yandex users: If you still see it, please let us know. For Chrome, as @chrmod said, a fix will be part of the upcoming release. |
8.9.5 has been released now on all platforms. |
It looks like after the update the error stopped repeating. Thanks |
On any site, an error appears in the console:
Uncaught (in promise) {message: 'A listener indicated an asynchronous response by r…age channel closed before a response was received'} message: "A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received"
It interferes quite a lot when working in the console
Steps to Reproduce
To check, you can go to https://www.google.com/, open the console and click on an empty space.
Several errors will appear almost immediately.
Versions
The text was updated successfully, but these errors were encountered: