Vero 🐙
01/03/2023, 11:18 AMJakob
01/03/2023, 1:09 PMcoldhands
01/03/2023, 9:11 PMSet-Cookie
header, but the browser recognizes it as a single cookie (it should split them into 2). The created cookie has a name and a value from the first one and other attributes like Path
and Max-Age
from the second one. My code: ts
// Next13, Edge Runtime
const headers = new Headers({
'Content-Type': 'application/json;charset=UTF-8',
'Set-Cookie': this.responseCookies.join(', '),
});
return new Response(JSON.stringify({ message: 'Sent' }), {
status: 200,
headers,
});
I've also built one local worker that uses Hono to send the same cookies and it works perfectly. this.responseCookies looks like this: ts
[
'refresh-token=...; Max-Age=2592000; Path=/api/auth/refresh; HttpOnly; SameSite=Lax',
'access-token=...; Max-Age=120; Path=/; HttpOnly; SameSite=Lax'
]
kian
01/03/2023, 9:41 PMkian
01/03/2023, 9:41 PMheaders.append
to add multiple Set-Cookie
headers.coldhands
01/03/2023, 10:08 PMset
to append
, still does not work. This is my code now ts
const headers = new Headers({ 'Content-Type': 'application/json' });
this.responseCookies.forEach((cookie) => {
headers.append('Set-Cookie', cookie);
});
console.log('all cookies', headers.get('Set-Cookie'));
return new Response(JSON.stringify({ message: 'Sent' }), {
status: 200,
headers,
});
I even tried everything ChatGPT told me and eventually it ran out of ideas 😢Skye
01/03/2023, 10:11 PMheaders.getAll('Set-Cookie')
to see themcoldhands
01/03/2023, 10:13 PMHeaders
are extended in CF Workers, but I don't think getAll()
is generally availableSkye
01/03/2023, 10:14 PMSkye
01/03/2023, 10:14 PMSkye
01/03/2023, 10:23 PMFirefly
01/04/2023, 6:46 AMpages
functions run on node or something more like v8?
Looking to see if I can get a better understanding of which API's I can use, I am assuming the same as functions (https://developers.cloudflare.com/workers/runtime-apis/) can anyone confirm this?kian
01/04/2023, 8:02 AMkian
01/04/2023, 8:02 AMHMM
01/04/2023, 7:27 PMInvalid Service name (name_of_worker). Check your Service name and try again. (Code: 8000022)
Walshy | Pages
01/04/2023, 7:29 PMWalshy | Pages
01/04/2023, 7:29 PMHMM
01/04/2023, 7:31 PMWalshy | Pages
01/04/2023, 7:32 PMfflaten
01/05/2023, 12:29 PMSkye
01/05/2023, 12:31 PMfflaten
01/05/2023, 12:32 PMJames
01/05/2023, 12:34 PMfflaten
01/05/2023, 12:37 PMJames
01/05/2023, 12:41 PMfflaten
01/05/2023, 12:43 PMSkye
01/05/2023, 12:44 PMfflaten
01/05/2023, 12:46 PMWalshy | Pages
01/05/2023, 1:58 PMJames
01/05/2023, 1:58 PM