Open wilfredonoyola opened 5 years ago
Hi @wilfredonoyola,
I don't know a lot about firebase, but here is a couple of possibilities.
Do you think you could add some debug logging or whatnot to test any of these theories?
Hey @nfriedly , thanks for reply!.
Let me know your comments
Thanks
Aah, I think I see the problem. When you export to static, it assumes that JavaScript will only be executing client-side, so I don't know that it even includes any server-side code. However, I believe that firebase virtual functions are actually executed in a server-side Node.js environment. So the client-side APIs to read cookies aren't going to work.
You might try just deploying a regular server-side build to firebase. I suspect it won't quite work out-of-the-box, but I think it's going to be closer to a solution. Next.js uses express.js under-the-hood, and I believe there are folks who have gotten that to work n firebase.
Alternatively, firebase provides some stuff for managing session cookies for you - https://firebase.google.com/docs/auth/admin/manage-cookies
I have created the follow function to detect if an user was logged frontend and server side
This works very good in my localhost both frontend/server side. But after deploy to firebase cloud function this only work with frontend side.
Let me know that I will do to fix this.
Thanks.