Skip to content

Yegair/next-on-netlify-minimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal set up for reproducing the next-on-netlify catch-all bug

The problem with this set up is that the pages/[[...any]].jsx is not served properly by Netlify. It is being rendered on the server correctly, because the pages/_app.jsx uses getInitialProps (which forces all pages to be rendered on the server).

When the page is being accessed it first correctly renders on the server. Then next tries to fetch the JS chunk corresponding to the pages/[[...any]].jsx page. It seems this chunk is again executed on the server resulting in pre-rendered HTML to be returned instead of JS.

At the time of writing the Netlify deployment can be accessed at https://condescending-allen-4992da.netlify.app/

network

The browser then tries to parse the result as JS which fails with a syntax error.

console

Workaround

There is a known workaround using a specific catch-all redirect (see netlify/next-on-netlify#41 (comment)).

To make it work a special catch-all redirect must be added to the _redirects file:

/_next/* /_next/:splat 200

About

Minimal sample for the catch-all next-on-netlify Bug

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published