unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

about netlify functions MultiValueHeaders #1058

Closed issue-up[bot] closed 1 year ago

issue-up[bot] commented 1 year ago
   Forwarded from downstream issue: - https://github.com/nuxt/nuxt/issues/19710 by @KeJunMao

### Describe the feature I am using `@sidebase/nuxt-auth`, and deploy to netlify. but the `__Secure-next-auth.state` and `__Secure-next-auth.session-token` in one 'set cookie' moreinfo :https://answers.netlify.com/t/multiple-set-cookie-headers-cause-netlify-lambda-to-throw-an-error/975/3 ### Additional information - [X] Would you be willing to help implement this feature? - [X] Could this feature be implemented as a module? ### Final checks - [X] Read the [contribution guide](https://nuxt.com/docs/community/contribution). - [X] Check existing [discussions](https://github.com/nuxt/nuxt/discussions) and [issues](https://github.com/nuxt/nuxt/issues).
pi0 commented 1 year ago

(closing until there is a nitro repro)

becem-gharbi commented 1 year ago

When adding multiple set-cookie headers on response, it seems that cookies are overwritten or merged. This behaviour happends on Netlify and Cloudflare as far as i know with Nitro v2.4.1. Works fine on Vercel.

export default eventHandler((event) => {
  setCookie(event, "cookie_1", "cookie_1_value");
  setCookie(event, "cookie_2", "cookie_2_value");
  return { nitro: "Is Awesome!" };
});

On development

image

On production

image

KeJunMao commented 1 year ago

@becem-gharbi hi, Sorry to be here @ You, Do you have any solutions with Netlify?

Hebilicious commented 1 year ago

@KeJunMao I believe this got fixed in https://github.com/unjs/nitro/pull/1452

becem-gharbi commented 1 year ago

Thanks