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

Created on 13 Nov 2018  ·  60Comments  ·  Source: gatsbyjs/gatsby

Description

I'm seeing an issue on my Gatsby V2 site when it loads and while the page is running.

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

image

Steps to reproduce

I started with the v2-starter- I don't have a demo site to link here :(

Expected result

There shouldn't be any console errors on load.

Actual result

There are console errors that I can't seem to track down.

Environment

System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.0.0 - ~/.nvm/versions/node/v11.0.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v11.0.0/bin/npm
Browsers:
Chrome: 71.0.3578.44
Firefox: 62.0.3

stale? needs more info needs reproduction

Most helpful comment

Hi everyone, I was having the same issue with the error occurring for every input on my page. It turns out that it was due to my Adblock Chrome Extension. I turned off the extension and the errors went away.

All 60 comments

I have reason to believe this might actually be Caddy, hold while I try to confirm that.

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

not stale

Having the same issue

Having the same issue

same on all pages (not only with gatsby)

Hey all, just to chime in since I was trying to debug this same problem and searching Stack Overflow. I don't think it's related to Gatsby. I found the culprit, a Chrome extension called Color Contrast Analyzer. Disable and it should disappear.

image

I don't have that extension and the same issue occurs when I'm in incognito mode, as well as on iOS Safari

Also experiencing this without the "Color Contrast Analyzer" Chrome extension. Note that for me, the error reproduces on mouse events: move, click. Otherwise, the number of errors does not increase.

I am facing the same issue, just the difference is that the count keep on increasing in milliseconds and never stops even at 400K.
image

image

Hi everyone, I was having the same issue with the error occurring for every input on my page. It turns out that it was due to my Adblock Chrome Extension. I turned off the extension and the errors went away.

Hi everyone, I was having the same issue with the error occurring for every input on my page. It turns out that it was due to my Adblock Chrome Extension. I turned off the extension and the errors went away.

It seems, that the problem is not in Adblock Extension, because after turned it off, i still have same issues.
and i have adblock plus.

I have same problem in every page. maybe chrome's fault?

I haven't been able to reproduce this problem so if anyone can share a reproduction that would be great! Post a list of your chrome extensions,...

A good way to test if it is chrome extensions might be just opening your browser in incognito and make sure no extensions are loaded.

Hi everyone, I was having the same issue with the error occurring for every input on my page. It turns out that it was due to my Adblock Chrome Extension. I turned off the extension and the errors went away.

It seems, that the problem is not in Adblock Extension, because after turned it off, i still have same issues.
and i have adblock plus.

I concur it is not AdBlock (i have the free version fyi). For me disabling Norton Safety Web got rid of the error message...

I haven't been able to reproduce this problem so if anyone can share a reproduction that would be great! Post a list of your chrome extensions,...

A good way to test if it is chrome extensions might be just opening your browser in incognito and make sure no extensions are loaded.

My extensions are AdBlock, Adobe Acrobat, Google Docs Offline, Hover Zoom+, Norton Identity Safe, Norton Safe Web and the Chrome Apps: Docs, Sheets and Slides.

I turned them all off to ensure the error disappeared, then turned them on 1-by-1 until the error appeared. I then turned all others off to ensure it was just the one extension (which it was, see above post :) )

Hi all, you are correct. I must've had a brain fart. The Chrome extension that I turned off was actually StayFocusd. AdBlock (free version) does NOT throw the error.

Seems like most have solved the issue here. For anyone circling back, we'd recommend this approach:

  1. Disable _all_ extensions
  2. Enable extensions (one by one) until the issue appears

    • If it does appear, you have found your culprit

Sounds like StayFocusd, Norton Safety Web, and Color Contrast Analyzer seem to be common culprits.

If we can help further, please feel free to comment and we'll take another look. Thanks to all!

I don't think it's extension related- I was seeing my Gatsby sites not load in iOS (vanilla Safari). I'll circle back on this when I get a chance to confirm and reopen if necessary.

It was the Color Contrast Analyze extension for me, uninstalled it and the error is gone.

Thanks @DSchau!

It was Google Publisher Toolbar 5.1.0 for me, disabled it and the error is gone.

Thanks!
D/

After disabling norton safe web, the error went away. Has anyone notified Symantec of this error? It started happening after I updated to latest chrome

for me, it was because of WhatFont - Find Font chrome extension.

DIsabling "1Password extension" for me worked

Definitely not a Gatsby issue, but happy to have found the issue solution here. The extension I had to deactivate was Kaspersky Internet Security. I wonder if anyone had the issue with Safari or Firefox. Seems to be a Chrome-only issue atm.
Symptoms in my case were not being able to use Google Apps SSO, the callback from Google Sign in SetID not happening to localhost.

I develop chrome extensions and as far as I can tell, for Chrome v70+, this is happening to all extensions that use chrome.runtime.sendMessage() and then try to use the response callback.

For me disabling StayFocused fixed the issue but it's not a Gatsby issue.

Developer of StayFocusd here. I can confirm that it is one of the culprits, but the real culprit is, as @atav32 mentioned, the chrome.runtime.sendMessage() API. That's the source of the error, but I haven't figured out the fix yet. If anyone else has, let me know.

UPDATE: Found the root cause. If you're using chrome.runtime.onMessage, and your callback has an async response, be sure to add return true in your callback function. Solution sourced from https://bugs.chromium.org/p/chromium/issues/detail?id=586155#c9.

Leaving this here for the next guy trying to figure out WTF is causing that error.

I ran across this issue with a Joomla! admin login page. Turns out I was using the wrong login #*^$!

Chrome threw the error, but Joomla! never said that I had the login incorrect. That in itself is strange because the admin page usually reports the login error. Took me a few minutes to figure out the login issue. I didn't seem to have any issue with extensions, one being LastPass which autofills. On or off, it didn't matter.

Sorry this wasn't much help - just adding to the puzzling issue.

I had tried turn off all chrome extension. Then enable one by one.
I had found that the extension Video Downloader professional and AdBlock caused the error.
I had about 25 extensions installed on my google chrome.
Note: There is not only one extension causes the error, but there are more extension that could lead to the error.

@KiengKnot this solution worked for me too. Thanks!

For me it was the OneLogin for Google Chrome extension. But it can be any extension really. Actual root cause seems to be outlined here -- https://github.com/gatsbyjs/gatsby/issues/9899#issuecomment-466862123

In my case, culprit is OneLogin for Google Chrome extension. @DSchau your solution works! Thanks!

"Video Downloader professional" extension caused this warning for me. After disabling it, the warning disappeared.

Hi everyone, I was having the same issue with the error occurring for every input on my page. It turns out that it was due to my Adblock Chrome Extension. I turned off the extension and the errors went away.

It seems, that the problem is not in Adblock Extension, because after turned it off, i still have same issues.
and i have adblock plus.

I concur it is not AdBlock (i have the free version fyi). For me disabling Norton Safety Web got rid of the error message...

i dont have any extension like this but i also have same error.

in my case that last error was coming for hola vpn extension. after disabling it now the last error is gone.

I had tried turn off all chrome extension. Then enable one by one.
I had found that the extension Video Downloader professional and AdBlock caused the error.
I had about 25 extensions installed on my google chrome.
Note: There is not only one extension causes the error, but there are more extension that could lead to the error.

Not sure why, but you're correct. Can confirm disabling did the trick for me as well.

For those coming here to debug this error in Chrome 73, one possible reason is that Chrome 73 onwards disallows cross-origin requests in content scripts.

More reading:

  1. https://www.chromium.org/Home/chromium-security/extension-content-script-fetches
  2. https://www.chromestatus.com/feature/5629709824032768

This affects many Chrome extension authors, who now need to scramble to fix the extensions because Chrome thinks "Our data shows that most extensions will not be affected by this change."

UPDATE: After fixing my extension CORS issue, I still see this error. I don't know what is causing it :/

WhatFont was causing it for me.

For me it was Video Downloader PLUS extension

In my case it was FBDown video downloader... already disabled it and contacted the author to fix the problem

Extension plugin problem, close some plugins to have a look, hope can help you.

reset your chrome Settings。it's ok.

found this about it with the polyfill webextension. See - https://github.com/mozilla/webextension-polyfill/issues/130

In my case it was friGate CDN

In my case was WhatAFont chrome addon

Was StayFocusd for me.

I have Adblocker as well as several other extensions. I disabled all except Vue dev tools. Error was gone. I enabled each one by one and 360 security extension was the culprit. Thanks for all the strategies on figuring it out it was bugging me for weeks!

In my case, it was Onetab chrome extension.

for me the culprit was meddlemonkey extension

The same thing here @SamizzotheGeek have you find any workaround yet? For now, I only disable it when working with dev tools, and re-enable it when I want to use it.

The manual toggling is kinda stressful :(

yes @aminukano585 it is caused by extensions. for me it was a youtube downloader extension. just switch off the extensions one by one while refreshing the browser. when the one causing it is closed, the message disappears.

My Norton Anti Virus Browser security tool was causing this for me. !

For me it was MeddleMonkey extension.

Disabling cVim fixed it for me

Anything Norton seems to throw an error for me.

For me it was the Kaspersky Protection extension. (you'd think antivirus developers would be a bit more careful with ensuring their products are bug-free!)

For me disabling the popular Chrome extension "Stylist" did the trick! I suggest anyone that has this issue should start by disabling all their extensions from Chrome. Good luck!

In my case: I do chrome.runtime.sendMessage twice

template lang="pug"
  .m-new-tab(@click="method")
    button(@click="method) // User click trigger the method twice
script
  method() => chrome.runtime.sendMessage
Was this page helpful?
0 / 5 - 0 ratings

Related issues

andykais picture andykais  ·  3Comments

ghost picture ghost  ·  3Comments

dustinhorton picture dustinhorton  ·  3Comments

KyleAMathews picture KyleAMathews  ·  3Comments

theduke picture theduke  ·  3Comments