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.

service worker swallows requests for files added to public/

See original GitHub issue

Is this a bug report?

i can’t tell, i suppose not.

Which terms did you search for in User Guide?

“service worker”

explanation

on my blog, the posts are stored in a file called posts.json, which i keep in public/. the route for printing out a handsome html list of posts data is /posts.

the posts themselves are built from markdown files that live in, for example, public/posts/an-example-slug.md. the url for the react rendered version of that post is /posts/an-example-slug.

a cute feature of that has been that if you would like to view the source of one of the posts, you can just add .md to the end of the url and there it appears in all its monospace fancy.

i was working on some feature changes last night and this morning, and i’ve upgraded react-scripts and have my setup working nicely with the service worker. except now the service worker jumps in between me and my public/ file request.

i’m just now realising it is also eating requests for my feed.rss and manifest.json and i’m beginning to wonder if i have done something terribly wrong.

can you think of anything i can do without ejecting? i suppose i can generate my own service worker based on the lodash template.

related

https://github.com/facebookincubator/create-react-app/issues/2253 https://github.com/facebookincubator/create-react-app/pull/2714

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
gaearoncommented, Sep 1, 2017

Instead of precaching everything in public, can instead force requests to it always go to network? Somehow.

0reactions
vivekiyer114commented, Nov 22, 2018

Here’s a quick fix for this.

// navigateFallback: publicUrl + '/index.html'

I just commented the navigateFallback function. Please let me know if there any demerits for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Service workers and base URIs - JakeArchibald.com
In a service worker fetch event, if you don't call event.respondWith within the event callback the browser handles the request and response ...
Read more >
Service Workers not updating - Stack Overflow
After googling and watching some videos on udacity, I found that the intended behavior of the worker is to stay until the page...
Read more >
Troubleshoot plug-ins - Power Apps - Microsoft Learn
This error simply means that the worker process running your plug-in code crashed. The reason it crashed may be your plug-in, but it...
Read more >
SF85P QUESTIONNAIRE FOR PUBLIC TRUST POSITIONS
This form will be used by the United States (U.S.) Government in conducting background investigations and reinvestigations of persons under.
Read more >
Using Service Workers and Cache to Take Web Performance ...
In this case network requests requests and responses. Notice I did not say files, but request & responses. When a response is cached...
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