Unchecked runtime lasterror the message port closed before a response was received как исправить

unchecked runtime.lasterror: the message port closed before a response was received error message can occure due browser extension or issue in the custom extension code

unchecked runtime.lasterror: the message port closed before a response was received error message can occur if there is any failure while communicating information (request and response) from background javascript and client script. You can see this error message in the browser’s console window.

unchecked runtime.lasterror: the message port closed before a response was received

This error is generally caused by the browser extensions. You are using an unsupported extension or your extension may have been corrupted. If you are developing a custom extension then there may be an issue with the extension code.

In this article we will study how to get rid of unchecked runtime.lasterror: the message port closed before a response was received error message. Go through the article thoroughly to understand the causes of this error message and their possible solutions.

Solution:

Following are the two possible solutions to resolve the error message.

1. Remove Extension

You can go to the chrome://extensions/ and disable all extensions. Now check if you are able to use chrome without any error message.

If you don’t get any error message, then there is an issue with one of the extensions. Enable extensions one by one and test them. In this way, you can identify which extension is the culprit and causing the issue and you can remove that extension. Chrome does not report explicitly which extension really causing the issue. So you have to toggle extensions one by one.

Following is the list of extensions that may cause the error message. Check if you have installed any of the below extensions.

  • 1password extension
  • Color Contrast Analyzer
  • Google Publisher Toolbar
  • Kaspersky browser extension
  • Norton Safe web
  • Tampermonkey
  • MeddleMonkey
  • Pinterest extension
  • Stay focused
  • Piggy – Automatic Coupons & Cash Back
  • BuiltWith Technology Profiler
  • HonorLock
  • Video Downloader Professional

The above list is just an example. It’s not necessary that you are also getting error messages because of the above extensions. We have given the list based on our experience and the feedback we received from our users.

Note:

A. You can use “Disable Extensions Temporarily” extensions to disable and enable all the extension with one click.

B. You can also try using chrome in incognito mode with do not allow extension setting and see if you are able to solve the issue.

If you are still getting the error message then it means there is no issue with the extension. Something else is causing the issue.

Check Other Articles

gotoxy() function in c++

Only integer scalar arrays can be converted to a scalar index

2. Add a return statement in the background message listener

If you are a developer and using or developing any new custom chrome extension then there may be some issue with your extension code that causes the unchecked runtime.lasterror: the message port closed before a response was received error message. Here we have explained in detail what part of the code can cause this error message and how to resolve it.

Please check the onMessage listener code snippet in your extension code. If this listener does not return the response correctly then it can result in the above error message.

Add return true in the onMessage call listener to resolve the error as shown below:

chrome.runtime.onMessage.addListener(function(rq, sender, sendResponse) 
{
     setTimeout(function() {
        sendResponse({status: true});
    }, 1);
     return true;  // Add return true to fix the error.
});

Note:

A. For some users breakpoint in the extension code was causing the issue. They were able to get rid of error message by removing the breakpoints. So try removing the breakpoints from the code and see whether error message is disappeared.

B. Sometimes antivirus blocks the custom code execution properly that may result in the error message. So try disabling antivirus extension and see whether it solves the error.

Conclusion:

We hope that the methods mentioned above are useful and you are able to identify the extension that causing the issue or able to fix the custom extension code. If you are still getting the unchecked runtime.lasterror: the message port closed before a response was received error message then please do mention it in the comment section or you can communicate with us using our official mail id hello.technolads@gmail.com

Thank you.

Chrome throws Unchecked runtime.lastError: The message port closed before a response was received when either there is a conflict with an extension or some of the onMessage listeners in your created extension is expected to return a promise.

Solution

To solve this issue, first toggle off all the installed extensions in your chrome browser. Then reload the page and check if the issue is resolved. You should not get any error this time. Now turn on the extensions one by one and keep checking the page by reloading after enabling an extension. If you are not getting the error then it means that extension is not causing problem. This way you will get to know the culprit and keep it off.

List of known extensions causing error

Here is the list of those extensions which causes unchecked runtime.lasterror –

  1. Video Downloader professional
  2. Flareget Integration
  3. MeddleMonkey
  4. Norton Safe Search
  5. Google Publisher Toolbar
  6. Norton Safe Web
  7. Video Speed Controller
  8. Kaspersky Protection
  9. Shortkeys (Custom Keyboard Shortcuts)
  10. What a font
  11. Color Contrast Analyzer
  12. Adskill
  13. Google™ Search Keyboard Shortcuts
  14. React-Sight
  15. Stylish
  16. Screen Capture
  17. OurStickys – Sticky Notes
  18. TamperMonkey
  19. Piggy
  20. Wappalyzer
  21. AdGuard
  22. Augury
  23. Google Voice
  24. DuckDuckGo Privacy Essentials
  25. StayFocusd
  26. 1password
  27. OneTab chrome 
  28. Automatic Backlink Checker
  29. Coupons at Checkout
  30. Sound Bar
  31. Auto Tab Discard
  32. NoCoffee Vision Simulator
  33. OrangeMonkey

There could be other extensions as well which could create problems. Keep an eye on the installed adblock or antivirus extensions.

    Tweet this to help others

For extension developers

If you are an extension developer and getting this error then it means you have issues in your onMessage calls. Check your extension files like background.js and look for all onMessage calls. See if you are returning anything or not.

chrome.runtime.onMessage.addListener(function(rq, sender, sendResponse) {
    setTimeout(function() {
        sendResponse({status: true});
    }, 1);
    return true;  // Return true to fix the error
});

This is Akash Mittal, an overall computer scientist. He is in software development from more than 10 years and worked on technologies like ReactJS, React Native, Php, JS, Golang, Java, Android etc. Being a die hard animal lover is the only trait, he is proud of.

Related Tags
  • chrome browser,
  • chrome extension,
  • javascript error,
  • javascript short

Всем привет, на главной странице сайта появилась ошибка, не пойму в чем беда и как разобраться?
Пока на функционал сайта никак не влияет.
О каком порте идет речь?

Uncaught (in promise) Object {message: "The message port closed before a reponse was received."}

015070f257794908997e394ed0c5f867.PNG


  • Вопрос задан

    более трёх лет назад

  • 42019 просмотров

Ошибка была из за приложения Wappalyzer Chrome, отключил и стало все нормально.

Пригласить эксперта

Создаю сайты. Открыл проект, работаю и херак ошибка «Unchecked runtime.lastError: The message port closed before a response was received.», перерыл все, благо нашел этот пост и отключил расширение «MeddleMonkey» все вернулось на круги своя. Если возникнут подобные проблемы, то первым делом проверьте расширения и отключите их все.

AdGuard Антибаннер также выдавал такую ошибку. При отключении плагина больше ошибки не возникало.

Тоже столкнулся с данной проблемой. Решил путем отключения всех расширений, что перестало выдавать ошибку, затем поочередно включал каждое расширение и выявил виновника. У меня это был «Защита от веб-угроз 360».

Отключил расширение Tab Scissors и всё нормализовалось.

Столкнулся с такой же ошибкой. Оказывается, когда делаешь обработку сообщений в chrome.runtime.addListener(hendled()), то выход из обработчика нужно прописывать как return true;
И в content_scripts и в background.


  • Показать ещё
    Загружается…

10 февр. 2023, в 04:49

50000 руб./за проект

10 февр. 2023, в 02:20

3000 руб./за проект

10 февр. 2023, в 01:33

1500 руб./за проект

Минуточку внимания

Comments

@lydell

lydell

added a commit
to lydell/webextension-polyfill
that referenced
this issue

Jun 19, 2018

@lydell

lydell

added a commit
to lydell/LinkHints
that referenced
this issue

Jun 25, 2018

@lydell

Use webextension-polyfill fork to fix
mozilla/webextension-polyfill#130

Make sure no `onMessage` listeners are `async`. `WorkerProgram` and
`RendererProgram` both listen to all messages from background, but only
handle the ones meant for them based on an `if` statement. However, if
the listener is an `async` function it will *always* return a Promise,
indicating that the listener wants to send a response. It is only
allowed to send *one* response per message per document. Otherwise
Chrome shows an error.

@rpl
rpl

mentioned this issue

Jul 2, 2018

soruly

added a commit
to soruly/trace.moe-WebExtension
that referenced
this issue

Feb 23, 2019

@soruly

rctay

added a commit
to ChessCom/chess-com-voice
that referenced
this issue

Mar 12, 2022

@rctay

…n, add catch to sendMessage() just in case

Without it, the sendMessage() promise would get rejected with the
message

    "The message port closed before a response was received."

The fix was suggested by mozilla/webextension-polyfill#130.

Add a catch handler to log the exception just to be on the safe side.

Как исправить проблему Chrome «Unchecked runtime.lastError: порт сообщения закрыт до получения ответа»?

Я использую VueJS и Laravel для своего проекта. Эта проблема начала проявляться в последнее время и проявляется даже в старых ветках git.

Эта ошибка отображается только в браузере Chrome.

Я отключил все установленные расширения в Chrome — у меня работает. У меня теперь чистая консоль без ошибок.

Если вы разработчик расширения, который искал в Google свой путь, пытаясь остановить эту ошибку:

Проблема не в CORB, так как заблокированные COR проявляются в виде предупреждений вроде —

Блокировка чтения из разных источников (CORB) заблокировала ответ из разных источников https://www.example.com/example.html с типом MIME text / html. См. Https://www.chromestatus.com/feature/5629709824032768 для получения дополнительных сведений.

Скорее всего, проблема заключается в неправильно обработанном асинхронном ответе на runtime.sendMessage. Как говорит MDN :

  • вернуть истину из прослушивателя событий. Это сохраняет функцию sendResponse действующей после возвращения слушателя, поэтому вы можете вызвать ее позже.
  • вернуть Promise из прослушивателя событий и разрешить, когда у вас есть ответ (или отклонить его в случае ошибки).

Когда вы отправляете асинхронный ответ, но не можете использовать ни один из этих механизмов, предоставленный sendResponse аргумент для sendMessage выходит за пределы области видимости, и результат в точности соответствует сообщению об ошибке: порт вашего сообщения (устройство передачи сообщений) закрывается до того, как ответ был получили.

Итак, суть в том, что если вы видите, что ваше расширение вызывает эти ошибки — внимательно проверьте всех своих слушателей onMessage. Некоторым из них, вероятно, нужно начать возвращать обещания (достаточно пометить их как асинхронные). [Спасибо @vdegenne]

WordPress. Ошибка Unchecked runtime.lastError: The message port closed before a response was received. Как исправить?

Есть сайт общественного движения против свалок sevsvalki.net
Сайт написан на WordPress, а я в нем ничего не понимаю.

На сайте есть функционал — «Оставить голос» против свалки. Например: sevsvalki.net/svalka/ul-gorpishhenko-126
При нажатии на кнопку, происходит изменение «Ваш голос учтен», но цифра не меняется. Консоль выдаёт ошибку: Unchecked runtime.lastError: The message port closed before a response was received.

Подскажите куда копать или может быть есть желающие помочь.

  • Вопрос задан более двух лет назад
  • 5401 просмотр
  • Facebook
  • Вконтакте
  • Twitter

Kozack

Ваша ошибка относится к какому-то расширению браузера и вообще не имеет отношения к проблеме.

А цифра не меняется потому что с сервера приходит 0 .

Перед тем как задавать такие вопросы, вы хоть бы отладчик браузера открыли и посмотрели как ваш скрипт работает.

Ошибка обещания порт сообщения закрыт до получения ответа

в chrome-расширение: / / gppongmhjkpfnbhagpmjfkannfbllamg/js / браузер-polyfill.js на этой строке:

вы знаете, что может вызвать это?

3 ответов

обновление:

Как комментарий morficus, проблема была исправлена в версии: 4.0.1

плагин будет автоматически обновляться или вы можете переустановить отсюда:

Если кто-то заинтересован в проблеме, запрос на вытягивание здесь:

старшего выпуска:

это не ошибка chrome, а ошибка с расширением wappalyzer.

Я не уверен, что вы используете его, но я использовал его и был просто обновлен и получил тот же вопрос.

вот доказательство выпуск:

нам нужно подождать, пока не будет никакого решения для расширения или использовать более старую версию расширения, пока она не будет решена.

в моем случае это было связано с расширением «Katalon recorder». Вероятно, самое общее решение:

  • отключить все расширения в chrome: / / extensions
  • включить расширения один за другим, чтобы определить, какой из них представляет проблему de.

это помогает мне преодолеть эту ошибку удалив Selenium (расширение Chrome)

Понравилась статья? Поделить с друзьями:
  • Uncharted legacy of thieves collection требуется windows 10 версии 1903 или выше как исправить
  • Unexpected error running liquibase could not acquire change log lock currently locked by
  • Unexpected error quitting перевод
  • Unexpected error quitting windows 10
  • Unexpected error quitting visual basic