Gatsby: `Gatsby-plugin-offline` Can't connect to site.

Created on 19 Sep 2019  Â·  10Comments  Â·  Source: gatsbyjs/gatsby

This occure after upgrade gatsby version or gatsby-plugin-offline.

pure installation:

https://github.com/bjatwork/gatsbyreproduce

Steps to reproduce:

  1. I install page on serwer with ssl
  2. Open page on mobile (chrome)
  3. Save page as PWA
  4. Disable internet connection on mobile
  5. Try open PWA from dekstop
  6. I get "Can't connect to site'
bug

Most helpful comment

Hey folks, sounds like this issue should be reopened, so I'll do that for the team to look into. Thanks for your comments with versions, that will help–and the team may ask for more details.

All 10 comments

What i observe after many tests on different mobiles:

  1. gatsby plugin offline 2.2.4:
  2. when i lunch PWA from dekstop with no internet connection sometimes works sometimes not
  3. when i lunch PWA directly in chrome (not from dektop) with no internet connection this works good

  4. gatsby plugin offline 3:

  5. when i lunch PWA from dekstop with no internet connection usually do not work
  6. when i lunch page in chrome (not from desktop) with no internet connection this usually not works

This can be reproduced on the gatsby site itself (https://www.gatsbyjs.org/).

Gatsby Site

  1. Load the page online https://www.gatsbyjs.org/
  2. Open devtools and go offline
  3. Reload the page
  4. Browser pukes 🤮

Screen Shot 2019-09-24 at 9 11 52 AM

Workbox Site

Meanwhile, on a page that implements workbox...

  1. Load the page online: https://developers.google.com/web/tools/workbox
  2. Open devtools and go offline
  3. Reload the page
  4. Continue with your life

Screen Shot 2019-09-24 at 9 14 08 AM

I've found that referencing all routes with their full (trailing slash included) pathname got this working for me. For example, instead of <Link to="/signin">, using <Link to="/signin/">. Had to change it everywhere also – including client-only routes.

No changes for me.
In console i have no errors.
Gatsby.org - this problems occur as well.

@davidbailey00 what are the chances for fix?

Hi everyone!

I've had a look at this and not quite sure what's going wrong in the examples, but it seems that if you update your version of Gatsby and gatsby-plugin-offline to the latest, then your sites should work offline again, leading me to believe there's some sort of version incompatibility going on.

This is also the issue with gatsbyjs.org - we are using offline v2, while upgrading to v3 and the latest Gatsby seems to fix this issue based on local testing. I'll create a PR to fix this.

Closing for now - please reopen if this is still an issue.

Screenshot_20191005-103217__01

Updated all my Gatsby dev to the latest yesterday, today I'm getting this on the app when offline.

If the PWA was running in the background, I can reopen it just fine and everything works inside (no broken navigation). But if I kill the PWA from my phone recents menu (Android), then the initial load fails.
Can this have something to do with the initial route setting? My initial route is the default, /.

Here is the relevant package.json excerpt :

"gatsby": "^2.15.28",
"gatsby-plugin-manifest": "^2.2.20",
"gatsby-plugin-offline": "^3.0.11",

I'm using the default plugin options.

I'm having the same issue with

    "gatsby": "^2.18.17",
    "gatsby-plugin-manifest": "^2.2.34",
"gatsby-plugin-offline": "^3.0.11",

All of which are the latest versions of all projects right now :/

Same issue with:
"gatsby": "^2.20.26",
"gatsby-plugin-manifest": "^2.2.47",
"gatsby-plugin-offline": "^3.0.40"

Hey folks, sounds like this issue should be reopened, so I'll do that for the team to look into. Thanks for your comments with versions, that will help–and the team may ask for more details.

Please open a new issue following our issue template (providing a reproducible reproduction!) as reviving this old issue without reproductions won't cut it. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  Â·  3Comments

dustinhorton picture dustinhorton  Â·  3Comments

ghost picture ghost  Â·  3Comments

hobochild picture hobochild  Â·  3Comments

brandonmp picture brandonmp  Â·  3Comments