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

[Bug - next-pwa]: FetchEvent.respondWith received an error #79

Open
aaronabf opened this issue Aug 31, 2023 · 10 comments
Open

[Bug - next-pwa]: FetchEvent.respondWith received an error #79

aaronabf opened this issue Aug 31, 2023 · 10 comments
Assignees
Labels
bug Something isn't working needs-help We need help with this next-pwa This is related to next-pwa no-stale This should not go stale reproduction-needed This needs a reproduction

Comments

@aaronabf
Copy link

aaronabf commented Aug 31, 2023

Provide environment information

next - 13.4.19
@ducanh2912/next-pwa - 9.5.0

Link to reproduction - Issues with a link to complete (but minimal) reproduction code help us address them faster

n/a

To reproduce

We are unable to successful reproduce the issue.

Describe the bug

We run this fork of next-pwa and are having users sporadically seeing this error message in Safari:

Safari can't open the page.
The error was: "FetchEvent.respondWith received an error: no-response: no-response :: ["url":"https://our-homepage-here"}]"

My best guess is it's an issue with this code block here, but I do not know this codebase very well.

Expected behavior

For this error to not surface.

Screenshots (if relevant)

original-E50BE68B-8570-4F38-8D13-F3C172ED0F6D

No response

Additional information (if relevant)

No response

@aaronabf aaronabf added bug Something isn't working next-pwa This is related to next-pwa triage New issues get this label, remove it after triage labels Aug 31, 2023
@DuCanhGH
Copy link
Owner

packages/next-sw is not what you are currently using as it is a work-in-progress at the moment. It is actually packages/next-pwa. Sounds like a weird issue, will investigate when I'm free :)

@aaronabf
Copy link
Author

aaronabf commented Aug 31, 2023

packages/next-sw is not what you are currently using as it is a work-in-progress at the moment. It is actually packages/next-pwa. Sounds like a weird issue, will investigate when I'm free :)

I see! Thanks for the quick reply.

There is this Stackoverflow post:

My PWA app sometimes cannot get data from server. It shows errors like:
FetchEvent.respondWith received an error: no-response: no-response Fetch API cannot load no internet connection
But if we reload the page, it could get data normally. And these bugs only happened in Safari. It is working well in Chrome or window devices.

This seems to align with what we are seeing as well, as only Safari users have reported issue and the sporadic nature can be explained by a spotty connection. This might just be a Safari bug but I wonder if there is some way to more gracefully avoid this failure.

@DuCanhGH
Copy link
Owner

@aaronabf went through the repo and yeah, maybe it's due to a slow internet connection. I honestly don't know why this is happening and how to fix it either. Seems like a Workbox or Safari issue because I've not found anything in the repo that could be causing this :( Maybe some help on reproducing would do the trick.

@pz129
Copy link

pz129 commented Aug 31, 2023

@DuCanhGH It seems to go away whenever you clear the browser cache. Once someone hits it, they will consistently have the issue until the cache is cleared.

@pz129
Copy link

pz129 commented Sep 7, 2023

@DuCanhGH any updates as to why this might be happening? it's not a good UX to tell users to clear their cache when this happens. Ideally it goes away without having to clear the cache.

@DuCanhGH
Copy link
Owner

DuCanhGH commented Sep 7, 2023

@pz129 I haven't a clue either. This can't really be reliably reproduced, so there's that.

@DuCanhGH DuCanhGH removed the triage New issues get this label, remove it after triage label Sep 12, 2023
@DuCanhGH
Copy link
Owner

DuCanhGH commented Sep 21, 2023

@aaronabf can I have your withPWA config and sw.js? I'd like to inspect the service worker to see if there's some weird stuff there.
I found this looking at minified workbox:

addFetchListener() {
  self.addEventListener("fetch", (t) => {
    const { request: e } = t,
      s = this.handleRequest({ request: e, event: t });
    s && t.respondWith(s);
  });
}

They made sure that the response is defined before calling event.respondWith, so I'm not sure what can even cause this issue. That's the only mention of respondWith, mind you. So it's most likely an internet connection issue, but I'm not sure why next-pwa is caching a non-response though.

@aaronabf
Copy link
Author

Huh that's really odd.

Our configuration is fairly minimal:

const withPWA = require("@ducanh2912/next-pwa").default({
  dest: "public",
  register: true,
  skipWaiting: true
})

And the sw.js can be found here: https://www.passes.com/sw.js

@DuCanhGH DuCanhGH added no-stale This should not go stale needs-help We need help with this reproduction-needed This needs a reproduction labels Oct 12, 2023
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale This has gone stale due to inactivity label Nov 12, 2023
@DuCanhGH DuCanhGH removed the stale This has gone stale due to inactivity label Nov 12, 2023
@DuCanhGH
Copy link
Owner

DuCanhGH commented Dec 8, 2023

IMG_5816
Just got this problem on my device today 😂 Took months to actually get it once. I'm guessing that this happens because there's no cached page to serve. Can you try using offline fallbacks to see if that helps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-help We need help with this next-pwa This is related to next-pwa no-stale This should not go stale reproduction-needed This needs a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants