[v2] [gatsby-plugin-offline] Service Workers throw errors when offline
See original GitHub issueIt 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
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:
- Created 5 years ago
- Reactions:2
- Comments:29 (25 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hey @fabe thanks for submitting this! I’m actually working on this problem right now!
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