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.

[Bug] 404s every page after enabling watch('content') to reloadRoutes() in static.config.js

See original GitHub issue

Are you reporting a bug?

Yes

Note: this issue originally filed on my rs-basic-test repo: https://github.com/theWebalyst/rs-basic-test/issues/1

Environment

react-static -V: 6.1.5
node -v: 8.11.3
npm -v: 6.4.1
Operating system: Ubuntu 18.10

Steps to Reproduce the problem

Starting with the basic template, I made small changes to get it to load content from markdown files by changing the relevant parts, based this other example: https://github.com/tannerlinsley/react-static-markdown (I chose to follow how that loads markdown having first failed to do this based on the code in the react-static archived markdown example).

You can reproduce the error by:

  • git clone https://github.com/theWebalyst/rs-basic-test/ && cd rs-basic-test && git checkout tags/take-content-from-markdown-files -b localtest && yarn && yarn start
  • visit http://localhost:3000/ and confirm Home, About, Blog etc load ok
  • remove the comment in static.config.js to enable reloadRoutes() at line 7
  • things work as expected if you just edit content
  • until you refresh the page or click on the navigation: Home, About, Blog etc all show a 404 error

I don’t see any errors in browser or terminal console (using Firefox), but note that there is still some console.log() debug output generated to the terminal by the build (see static.config.js 15-17)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
tannerlinsleycommented, Mar 7, 2019

Yes I can.

On Thu, Mar 7, 2019 at 7:40 AM Oscar Beaumont notifications@github.com wrote:

@tannerlinsley https://github.com/tannerlinsley can you have a look at this?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/nozzle/react-static/issues/985#issuecomment-470551185, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCcxrhoIIzdd2NUtFYAb-aa_bta9Zks5vUST2gaJpZM4aMiti .

3reactions
oscartbeaumontcommented, Mar 2, 2019

I am also having this issue. If I startup react-static and then just save the static.config.js without even making a change to the file, all of my routes return 404.

Read more comments on GitHub >

github_iconTop Results From Across the Web

404s every page after enabling watch('content') to reloadRoutes() in ...
Using yarn start the localhost site displays home, about and blog posts as expected until I uncomment the following line in static.config.js :....
Read more >
Next.js Error Getting 404 When Fetching JS Resources After ...
Solved by removing assetPrefix: "." from next.config.js file. This setting makes the assets path based on the current pages instead of the ...
Read more >
ASP.NET Routing Debugger | You've Been Haacked
This utility displays the route data pulled from the request of the current request in ... ReloadRoutes() should be called after Listen() in ......
Read more >
Azure Static website react.js getting 404 in the browser but ...
So like I normally setup static websites, with error page going back to index.html. The browser response shows a 404 though, on local...
Read more >
static - JavaScript - MDN Web Docs - Mozilla
The static keyword defines a static method or field for a class, or a static initialization block (see the link for more information...
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