I am using the netlify adapter and trying to set a cookie on edge.
This test code is not working, cookie is never set:
import { defineMiddleware } from 'astro:middleware';
export const onRequest = defineMiddleware(async (context, next) => {
console.log('[Debug] Incoming request:', context.request.url);
context.cookies.set('test_cookie', 'hello-world', {
path: '/',
httpOnly: true,
sameSite: 'strict'
});
console.log('[Debug] test_cookie set');
console.log('[Debug] Passing to next middleware');
return next();
});