Skip to content
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

Problems with auto generated service-worker on old safari webview #706

Open
EberhardSchneider opened this issue Apr 30, 2024 · 0 comments
Open

Comments

@EberhardSchneider
Copy link

EberhardSchneider commented Apr 30, 2024

Environment information

Software Version
vite 5.0.13
vite-plugin-pwa 0.17.5
Operating System macOS Catalina
Browser Safari 15.6.1
Service Worker Auto-generated service-worker

Describe the bug

A GET request, which fits the NetworkOnly strategy in the workbox config fails with the following error:
FetchEvent.respondWith received an error: no-response: no-response :: [{"url":"https://.../latest.json","error":{}}]

Expected behaviour

The service worker should handle the GET request correctly.

What we tried to solve this

As the service worker just uses workbox.registerRoute to handle the route, I suspect, that the error roots somewhat deeper.

Writing the service worker manually resolves the issue, but we would prefer to use the standard libraries.

Configuration

 VitePWA({
                manifest: {
                    ...
                },
                strategies: 'generateSW',
                registerType: 'autoUpdate',
                injectRegister: 'script',
                workbox: {
                    globPatterns: ['**/*.{js,tsx,json,css,html,ico,png,svg,eot,woff,woff2,ttf}'],
                    skipWaiting: true,
                    clientsClaim: true,
                    cleanupOutdatedCaches: true,
                    runtimeCaching: [
                    ...
                        {
                            urlPattern: /https:\/\/complete_url\/latest\.json/,
                            handler: 'NetworkOnly',
                        },

Screenshots

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant