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.

Errors from code splitting with Redwood Router (potentially)

See original GitHub issue

Hi All, first of this is going to be a deep an obscure post, so bear with me!

Whats the problem? We have bugsnag enabled on our RW site, and every now and then I see an error related to loading chunks. The bug is incredibly difficult to reproduce, but from looking at the logs, it only happens when trying to navigate with redwood router, and the chunks need to be loaded. A few examples:

Example 1: (chunk is definitely there on the server)

ChunkLoadError Loading chunk 7 failed.
(missing: https://www.tape.sh/static/js/7.e9f522d7.chunk.js) 

Example 2:

SyntaxError Unexpected token '<' 
    https://www.tape.sh/static/js/7.e9f522d7.chunk.js:1:1 

Syntax error, really?

Example 3: (similar to above)

Error Network error: JSON Parse error: Unrecognized token '<' 
    ../../node_modules/apollo-client/bundle.esm.js:63:32 ApolloError

Other info that may be relevant

  • We are using cloudflare in front of netlify, but I disabled netlify’s asset optimisation for JS because it does the weird thing of moving it into a different path on cloudfront. I want to let cloudflare handle all the caching netlify-settings

I’m not sure if its something that’s happening between cloudflare and netlify, but right now leaning towards RR/Webpack doing something

  • The unexpected token < error, I wonder if the server is returning html - but why would it do this and why would it happen so rarely?

  • I’m going to try disabling the automatic code splitting on RR, and see if it makes a difference.


Redwood version: 0.12

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dac09commented, Jul 27, 2020

@dthyresson - thank you, this is extremely helpful. I’ll look at trying this out in our staging env today.

1reaction
dthyressoncommented, Jul 27, 2020

it receives a 522

Might be worth checking out:

Saw this note on Netlify Community about 522s + Netlify + Cloudflare: https://community.netlify.com/t/522-error-connection-timed-out/8138

522 is usually reported via Cloudflare, and if you are seeing it from Cloudflare, the only way you’d get it on a Netlify site is if that site were misconfigured as described in

https://community.netlify.com/t/common-issue-why-isn-t-my-ssl-certificate-provisioning-automatically-with-cloudflare-netlify-are-there-other-problems-with-using-cloudflare-in-front-of-netlify/138

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with Code Splitting Network Failures - In Plain English
After some digging, I realized the root cause was the network. More chunks meant more requests, which meant more chances of a network...
Read more >
A Second Page and a Link | RedwoodJS Docs
Redwood will automatically code-split on each Page, which means that initial page loads can be blazingly fast, and you can create as many...
Read more >
Webpack code-splitting an app that uses relay - Stack Overflow
Relay depends on a few static calls to classes such as getFragment . In this case, webpack has pushed TodoListFooter into a different...
Read more >
RFC: File System-Based Native Routing with Expo and React ...
Expo Router has the ability to set up React Error Boundaries for each route (Suspense boundaries coming in a later version).
Read more >
PlE - River Thames Conditions - Environment Agency - GOV.UK
Memorial history of louisville, 60 errors english usage tests, Vw 21 window bus ... 100mm wide masking tape, C-7 980 error code, Terugvinden...
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