question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] [gatsby-plugin-offline] Service Workers throw errors when offline

See original GitHub issue

It seems that service workers are broken on v2. They are successfully installed, but return errors when the user is offline:

Cannot read property ‘pageContext’ of undefined

screen shot 2018-06-28 at 10 42 56 am

This also leads to this Lighthouse warning:

Service worker does not successfully serve the manifest’s start_url.

Could potentially be related to the pageContext rename?

Steps to reproduce

Example repo: https://github.com/fabe/test-gatsby-v2-offline
Production build: https://peaceful-wozniak-ecfc89.netlify.com

Reload the site while offline (after installing the service worker).

Environment

  System:
    OS: macOS High Sierra 10.13.5
    CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 8.11.3 - /usr/local/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 5.6.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 67.0.3396.99
    Safari: 11.1.1
  npmPackages:
    gatsby: next => 2.0.0-beta.12
    gatsby-plugin-offline: ^2.0.0-beta.2 => 2.0.0-beta.2
  npmGlobalPackages:
    gatsby-cli: 1.1.58

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:29 (25 by maintainers)

github_iconTop GitHub Comments

6reactions
kkemplecommented, Jun 28, 2018

hey @fabe thanks for submitting this! I’m actually working on this problem right now!

2reactions
valerie-makescommented, Aug 15, 2018

I’m making progress on a better fix, although it’s taking me a long time due to various interdependent bugs which I’m also trying to fix. I’ll post an update later when I’ve made more progress

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Offline Support with a Service Worker - Gatsby
You can add a manifest file. Ensure that the manifest plugin is listed before the offline plugin so that the offline plugin can...
Read more >
Gatsby Offline Plugin Workbox Strategies - YouTube
Your Gatsby website is accessible without an internet connection, but are you sure your caching strategy is accurate for all resources?
Read more >
Gatsby blog as PWA (Progressive Web App) | Željko Šević
In case of issues with caching in a local environment, an offline plugin can be disabled. // gatsby-config.js. const plugins = [.
Read more >
Gatsby Changelog | 5.3.0
In normal circumstances the errors thrown by GraphQL or Gatsby itself will ... Fix React 18 hydration with offline plugin via PR #35319;...
Read more >
gatsby-plugin-offline - npm
It uses Workbox Build to create a service worker for the site and loads the service worker into the client. If you're using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found