how to render ssr project on firebase hosting without using functions?

Viewed 1614

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.

2 Answers

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!

Related