File tree 1 file changed +4
-1
lines changed
packages/runtime/src/templates/edge-shared
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ export const addMiddlewareHeaders = async (
58
58
}
59
59
60
60
interface ResponseCookies {
61
+ // This is non-standard that Next.js adds.
62
+ // See github.com/vercel/next.js/blob/de08f8b3d31ef45131dad97a7d0e95fa01001167/packages/next/src/compiled/@edge -runtime/cookies/index.js#L158
61
63
readonly _headers : Headers
62
64
}
63
65
@@ -191,7 +193,8 @@ export const buildResponse = async ({
191
193
}
192
194
193
195
// NextResponse doesn't set cookies onto the originResponse, so we need to copy them over
194
- if ( response . cookies . _headers . has ( 'set-cookie' ) ) {
196
+ // In some cases, it's possible there are no headers set. See https://github.com/netlify/pod-ecosystem-frameworks/issues/475
197
+ if ( response . cookies . _headers ?. has ( 'set-cookie' ) ) {
195
198
response . originResponse . headers . set ( 'set-cookie' , response . cookies . _headers . get ( 'set-cookie' ) ! )
196
199
}
197
200
You can’t perform that action at this time.
0 commit comments