Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Add failing test for res.redirect #74

Closed
wants to merge 1 commit into from

Conversation

afzalsayed96
Copy link
Contributor

@afzalsayed96 afzalsayed96 commented Nov 11, 2020

Hi,

I was trying to deploy a Next site with preview mode on Netlify and was stuck on this error for quite some time:

Screen Shot 2020-11-10 at 6 46 45 PM

The final solution that resolved the issue was changing

  res.redirect(req.query.slug)

to

  res.writeHead(307, { Location: req.query.slug });
  res.end();

I'm under the impression that the first syntax is supposed to be valid and was taken from the official Next.js docs for preview mode. Hence, I've created a failing test so anyone here could take a look at the issue and find the root cause if interested.

Thanks and cheers!

@afzalsayed96
Copy link
Contributor Author

afzalsayed96 commented Nov 11, 2020

If this is something that's already known then I apologise and would like to suggest that it be documented somewhere with higher visibility.

@afzalsayed96 afzalsayed96 changed the title Add failing test Add failing test for res.redirect Nov 11, 2020
@lindsaylevine
Copy link
Contributor

was just able to repro in my own project after deploying. not immediately clear why this is happening but will investigate and keep you updated. thanks for opening this with the test <3.

@lindsaylevine
Copy link
Contributor

update: we think we've discovered the issue here. i think @FinnWoelm will be opening his own PR soon!

@lindsaylevine
Copy link
Contributor

closing per #93 ! thanks again <3

@afzalsayed96 afzalsayed96 deleted the redirect-test branch November 18, 2020 10:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants