The server crashes when getServerSideProps finishes executing
See original GitHub issueBug report
Describe the bug
I’m trying to use next/link
to refer to a route that uses getServerSideProps
for redirection, and the server crashes when getServerSideProps
finishes executing.
To Reproduce
Repository: next.js-bug-redirect Steps to reproduce the behavior:
- Go to http://localhost:3000
- Click on
Home
link - See error
Expected behavior
Redirecting back to /about
.
Screenshots
System information
- OS: macOS
- Browser (if applies): chrome
- Version of Next.js: 9.4.4
- Version of Node.js: 14.2.0
Additional context
Tried to run it with next@canary
, but it also crashes.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Next.js Tutorial - Part 9 | Data Fetching with getServerSideProps
In this video, we will understand getServerSideProps using code and diagrams! We will look into the differences/similarities between ...
Read more >Data Fetching: getServerSideProps - Next.js
When does getServerSideProps run. getServerSideProps only runs on server-side and never runs on the browser. If a page uses getServerSideProps , then:.
Read more >KB326823: MicroStrategy Intelligence Server 10.x crashes ...
KB326823: MicroStrategy Intelligence Server 10.x crashes when executing a document containing a data import cube with a circular reference.
Read more >nextjs getServerSideProps show loading - Stack Overflow
It looks like nothing happens for 2 seconds (the api delay) and then the content shows. I can see in the network tab...
Read more >Crash Course with Remix Run which is a NEW Full Stack JavaScript ...
In this video, I will go deeper into the core concepts in @Remix as We build a blog app with Prisma and Sqlite....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Related to #14890 and #12409 I believe
@timneutkens sorry, I’ve removed all repositories related to the next.js bugs.
Your reproduction code seems correct except commented
writeHead
andend
calls. This code throws an error with next.js9.4.4
and nodes14
and16
as pointed out in the description issue. However, you are right, with next.js12.0.7
such redirection just doesn’t apply.P.S. Despite all, if anyone else comes across this problem then it is highly recommended to use a more idiomatic
redirect
value that works correctly with the newest next.js versions.