Open MattyBalaam opened 7 months ago
@MattyBalaam hmm I would expect remix to return a valid Headers object, which would mean it should return the following
HeadersList {
cookies: [ 'cookie1=value1', 'cookie2=value2' ],
[Symbol(headers map)]: Map(1) {
'set-cookie' => { name: 'Set-Cookie', value: 'cookie1=value1, cookie2=value2' }
},
[Symbol(headers map sorted)]: null
}
👉 https://replit.com/@wingleung1/UnripeSunnyProgrammers
But what I receive from remix is an object containing an array value in headers, which is not compliant with the apigwV1 model
headers: {
'content-type': 'text/html',
'set-cookie': [ 'cookie1=chocolate-chip', 'cookie2=oatmeal' ]
}
Created a PR with a workaround 👉 #15
meantime, could you try using comma delimiters?
const session1 = await commiSession1()
const session2 = await commiSession2()
return json(
{ success: true },
{
headers: {
"Set-Cookie": `${session1}, ${session2}`
}
}
)
🙏 merged to develop and published a beta version 👉 1.3.0-beta.1
Following the pattern outlined here of setting multiple headers works in local node environment: https://github.com/remix-run/remix/issues/231
However, when running using the createRequestHandler from this package (only tried using AWSProxy.APIGatewayV1) only the last cookie is set.
Looking at the code it may be because you are not returning
multiValueHeaders
, justheaders
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html