Skip to content
Discussion options

You must be logged in to vote

Hey so I had this same issue when using express as my custom server on localhost. When I inspected the request that sets setPreviewData it was complaining that the cookie not being set over HTTPS.

Workaround:

...

res.setPreviewData({})

// Remove secure requirement for Cookies if on localhost
if(process.env.NODE_ENV === 'development') {
	const cookies = res.getHeader('Set-Cookie');
  	res.setHeader('Set-Cookie', cookies.map((cookie) => cookie.replace('Secure;', '')))
}

...

I'm going to dig into a cleaner way of handling this.

Edit

Looks like this is an issue with https://github.com/vercel/next.js/blob/canary/packages/next/next-server/server/api-utils.ts#L473

Logging out the value of pr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ambrauer
Comment options

Answer selected by cidicles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #16766 on September 10, 2020 21:40.