When paired with a custom server setPreviewData is not working #16766
-
Bug reportDescribe the bugWhen using a custom server the To Reproduce
Expected behaviorThe System information
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey so I had this same issue when using express as my custom server on localhost. When I inspected the request that sets 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 |
Beta Was this translation helpful? Give feedback.
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:
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…