I'm just started out with Firebase Hosting and going through the Tutorial on Initialize a Firebase Project. When I proceed to firebase deploy
, I had this error message:
> tsc
✔ functions: Finished running predeploy script.
i database: checking rules syntax...
✔ database: rules syntax for database salesman-firebase001 is valid
i firebase.storage: checking storage.rules for compilation errors...
✔ firebase.storage: rules file storage.rules compiled successfully
i firestore: reading indexes from firestore.indexes.json...
i cloud.firestore: checking firestore.rules for compilation errors...
✔ cloud.firestore: rules file firestore.rules compiled successfully
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
Error: HTTP Error: 400, Must supply a non-empty glob/regex pattern with rewrite configuration
I had gone Configure rewrites, added the necessary components to my firebase.json
. The updated code for hosting
:
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
// Serves index.html for requests to files or directories that do not exist
"source": "**",
"destination": "/index.html"
}, {
// Serves index.html for requests to both "/foo" and "/foo/**"
// Using "/foo/**" only matches paths like "/foo/xyz", but not "/foo"
"source": "/foo{,/**}",
"destination": "/index.html"
}, {
// A regular expression-based rewrite equivalent to the above behavior
"regex": "/foo(/.*)?",
"destination": "/index.html"
}, {
// Excludes specified pathways from rewrites
"source": "!/@(js|css)/**",
"destination": "/index.html"
} ]
},
Thanks for your time.