-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes does not register service worker when deployed to Vercel #40
Comments
Check if sw.js and manifest webmanifest are there, latter should be served with custom content type (https://github.com/vite-pwa/nuxt/blob/main/src/module.ts#L159), try enabling https://github.com/vite-pwa/nuxt/blob/main/src/types.ts#L47 in nuxt pwa options |
@crunchwrap89 @tberk can you test adding Check the local build using |
Still getting the same error. I also tested on dev, it detects start_url fine there, no problem. pwa: {
registerType: 'autoUpdate',
registerWebManifestInRouteRules: true,
manifest: {
name: 'appname',
short_name: 'appname',
description: 'Some description.',
theme_color: '#fff',
icons: [
{
src: 'pwa/pwa-64x64.png',
sizes: '64x64',
type: 'image/png',
},
{
src: 'pwa/pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: 'pwa/maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
navigateFallback: null,
globPatterns: ['**/*.{js,css,html,png,svg,ico}'],
},
client: {
installPrompt: true,
},
devOptions: {
enabled: true,
suppressWarnings: true,
navigateFallbackAllowlist: [/^\/$/],
type: 'module',
},
}, |
@tberk can you share the url? |
Sure, I sent an email to you with the link. btw, I noticed something, If I test in Incognito mode all checks seem fine, it shows start_url. |
This is weird, tested you app in private browsing and it is working, I'll check it in normal browsing and review the headers... In the mean time, check out https://vite-pwa-org.netlify.app/deployment/, the sw is quite sensible... |
@tberk seems working, http headers properly configured by Nuxt, can you remove storage including (check Unregister service worker) service worker from Dev Tools > Application > Storage > Clear site data button? |
I'm beginning to suspect this might be some sort of peculiar UI bug or something similar. Aside from that check, I don't encounter any issues with PWA. In addition to incognito mode, PWA testing tools also appear to be successful. I've used the "Clear Site Data" function along with other methods to try and clear site data, but the start_url still isn't visible on either my Edge or Chrome browsers. However, I am ready to overlook this issue for now as it doesn't cause anything that I noticed. Thank you for your responses, @userquin. |
When i run lighthouse on my Nuxt 3 app that has been deployed to Vercel, the score will sometimes fail due to this "Does not register a service worker" issue:
Sometimes when refreshing the page and running lighthouse again it works fine:
It looks like
This is my config:
´´´
pwa: {
registerType: 'autoUpdate',
manifest: {
name: 'GeoQuestr',
short_name: 'GeoQuestr',
theme_color: '#0a1a1f',
description: 'Build and play location based games.',
background_color: '#0a1a1f',
icons: icons.icons
},
workbox: {
navigateFallback: '/',
globPatterns: ['**/*.{js,css,html,ico,png,svg,gltf,bin}'],
maximumFileSizeToCacheInBytes: 25097152
}
},
´´´
Any ideas why its not stable? Also, the asset downloads by the service worker is super slow, is this related to any throttling on vercel's side?
The text was updated successfully, but these errors were encountered: