Mike Kim
Mike Kim

Reputation: 63

Firebase is not picking up my index.js located in functions folder

I want to make sure if Firebase automatically hosts whatever html file is in "Public" folder located in my root directory and if it can't find that, it will host whatever is sitting inside "functions" folder. Is it correct? Or does it specifically look for index.html within Public folder and then specifically look for index.js within functions folder?

Upvotes: 0

Views: 728

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317352

According to the documentation for Firebase Hosting rewrites to Cloud Functions:

Note: The static files in the public directory take precedence over the rewrites, so any static files will be served alongside the Cloud Functions endpoints.

So, static content always gets served in preference to rewrites to Cloud Functions.

A request for / that results in a lookup for index.html will always prefer the static content in index.html if it exists.

You should make sure your static content doesn't "shadow" any of your functions, based on a comparison of their exact paths.

Upvotes: 1

Related Questions