As (indirectly) mentioned in the firebase functions docs, https functions are suppose to support manipulating cookies in request / response headers.
If you need to inject middleware dependencies for things like cookie support or CORS, call these within the function.
However, the following HTTPS function returns a response which does not contain a set-cookie
header to the client:
functions.https.onRequest(async (request, response) => {
response.set('access-control-allow-origin', '*');
response.cookie('TEST COOKIE', 'Success!!!!');
console.log(response.get('set-cookie'));
response.json({ status: 'success' });
});
Strangely, the call to console.log(response.get('set-cookie'))
shows me that the set-cookie
header is set at that point in the function call. So somehow the set-cookie
header is being stripped from the response. This certainly seems like firebase functions don't actually support manipulating cookies.
Does anyone have any idea what's going on? I've been trying to figure this out for hours now :(