File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/runtime/src/templates/edge-shared Expand file tree Collapse file tree 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 (
5858}
5959
6060interface 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
6163 readonly _headers : Headers
6264}
6365
@@ -191,7 +193,8 @@ export const buildResponse = async ({
191193 }
192194
193195 // 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' ) ) {
195198 response . originResponse . headers . set ( 'set-cookie' , response . cookies . _headers . get ( 'set-cookie' ) ! )
196199 }
197200
You can’t perform that action at this time.
0 commit comments