I was following tutorial on this page https://github.com/firebase/functions-samples/tree/master/google-sheet-sync. When I finaly reached step 11 where I need to deploy this project I got this error: "Must supply a public directory using "public" in each "hosting" config". After some googling I changed my firebase.jsom from this:
{
"functions": {
"source": "functions"
},
"hosting": {
"rewrites": [
{
"source": "/oauthcallback",
"function": "oauthcallback"
},
{
"source": "/authgoogleapi",
"function": "authgoogleapi"
},
{
"source": "/testsheetwrite",
"function": "testsheetwrite"
}
]
}
}
to this:
{
"functions": {
"source": "functions"
},
"hosting": {
"public": "functions",
"rewrites": [
{
"source": "/oauthcallback",
"function": "oauthcallback"
},
{
"source": "/authgoogleapi",
"function": "authgoogleapi"
},
{
"source": "/testsheetwrite",
"function": "testsheetwrite"
}
]
}
}
It helped and project was successfully deployed, but at step 12 I got error "SITE NOT FOUND". After some more googling I found this https://github.com/firebase/functions-samples/issues/446, but I don't understand last comment. What does full firebase deploy that includes hosting means?
He is talking about the official docummentation here that indicates the Hosting
part of your Firebase application. This can be achieved by using the command firebase init
. Once this is run, it will creates the firebase.json
file that you needs to configure your paths, hosting, etc.
In addition, as the official documentation indicates:
The firebase.json file is required to deploy assets with the Firebase CLI because it specifies which files and settings from your project directory are deployed to your Firebase project.
So, this means that you need to run the "full deploy", so you will have your jsojn file correctly created and add the hosting configuration from your project as indicated in this comment to the constant FUNCTIONS_REDIRECT
.
Once you have done that, you should not have issues with the deployment anymore.
Let me know if the information helped you!