From 3435b7f1e1ca38fdee8f3b89e2d2667f125d01b5 Mon Sep 17 00:00:00 2001 From: Arsh <69170106+lilnasy@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:17:33 +0000 Subject: [PATCH] fix(vercel): make Astro.cookies work again (#9809) * addCookieHeaders * add changeset --- .changeset/two-ducks-give.md | 5 +++++ packages/integrations/vercel/src/serverless/entrypoint.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/two-ducks-give.md diff --git a/.changeset/two-ducks-give.md b/.changeset/two-ducks-give.md new file mode 100644 index 000000000000..5782469390ec --- /dev/null +++ b/.changeset/two-ducks-give.md @@ -0,0 +1,5 @@ +--- +"@astrojs/vercel": patch +--- + +Fixes an issue where the serverless function ignored cookies added using Astro.cookies. diff --git a/packages/integrations/vercel/src/serverless/entrypoint.ts b/packages/integrations/vercel/src/serverless/entrypoint.ts index a300b8a12f8b..fe88c367d320 100644 --- a/packages/integrations/vercel/src/serverless/entrypoint.ts +++ b/packages/integrations/vercel/src/serverless/entrypoint.ts @@ -20,7 +20,7 @@ export const createExports = (manifest: SSRManifest) => { : Array.isArray(localsHeader) ? JSON.parse(localsHeader[0]) : {}; - const webResponse = await app.render(req, { locals, clientAddress }); + const webResponse = await app.render(req, { addCookieHeader: true, clientAddress, locals }); await NodeApp.writeResponse(webResponse, res); };