netlify / remix-template

Deploy your Remix site to Netlify
83 stars 27 forks source link

Only one cookie is being set when you have multiple Set-Cookie #131

Closed silentworks closed 8 months ago

silentworks commented 11 months ago

Describe the bug When using Netlify build we are only getting one cookie set when we have multiple Set-Cookie in the header. This is inconsistent with how the Remix dev server works and how the MDN docs say it should work.

To Reproduce Steps to reproduce the behavior:

  1. Create a new remix app using the netlify template npx create-remix@latest --template netlify/remix-template
  2. Edit the app/root.tsx file and add the following
    
    import type { MetaFunction } from "@remix-run/node";
    import {
    Links,
    LiveReload,
    Meta,
    Outlet,
    Scripts,
    ScrollRestoration,
    } from "@remix-run/react";
    import { json } from '@remix-run/node';

export const meta: MetaFunction = () => [{ charset: "utf-8", title: "New Remix App", viewport: "width=device-width,initial-scale=1", }];

export const loader = async () => { const ckHeaders = new Headers([ ["Set-Cookie", "lulu=meow; Max-Age=3600; Path=/; SameSite=Lax"], ["Set-Cookie", "booya=kasha; Max-Age=3600; Path=/; SameSite=Lax"], ]);

return json( {}, { headers: ckHeaders, } ); };

export default function App() { return (

); }


3. Run the build and start the netlify server using `npm run build && npm start`
4. When the browser opens check your cookie storage and you will notice only the second cookie was saved.

**Expected behavior**
Both cookies should be saved and not only the second one.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: MacOS
 - Browser Firefox
 - Version 2.2.0

**Additional context**
Add any other context about the problem here.
ascorbic commented 11 months ago

Thanks for the report. We've identified this as a bug in our new functions runtime so will prioritise a fix.

ascorbic commented 11 months ago

We have a fix ready. I'll update this ticket when it's rolled out

silentworks commented 11 months ago

Thank you so much for this @ascorbic.