I built a website and deployed it to firebase and everything was rendered correctly. I changed the project architecture to be Server-Side-Rendering, which means that now I run 'server.js' file and not 'index.html'. Is there any way to host my SSR website on firebase without using 'Functions'? I researched the web but couldn't find any other approach.
Firebase Hosting serves only static assets. It does not in any way interpret the files that it servers.
The only way to get the code in interpreted server-side is by linking Firebase Hosting with Cloud Functions, or Cloud Run. If you don't want to do that, there's no way to get SSR on Firebase Hosting.
As of 2022, Google is testing Firebase Extended which will soon support SSR or Server Side Rendering with Framework Awareness. It's still in preview and there isn't a definite timeline yet. Check this link for more info:-
https://github.com/FirebaseExtended/firebase-framework-tools/
Until then I would suggest using GCP's Cloud Run, which can run http based stateless containers.
With Firebase Hosting's SSR, I am guessing it will use a combination of Cloud Functions and Hosting internally with that we don't need to take care of the under the hood props like the location, cpu etc. Happy Coding!
Update April 2023
Firebase has now integrated this into it's cli. I've used this for one of our projects and it seems to do a pretty neat job.
It basically creates a Cloud Run instance in the background without the need to build and update a docker container.
https://firebase.google.com/docs/hosting/serverless-overview
© 2022 - 2024 — McMap. All rights reserved.