battery
battery

Reputation: 522

Firebase deploy fails after adding second project

After adding a second project to my code using the command $ firebase use --add second-project, I get the error

There was an issue deploying your functions. Verify that your project has a Google App Engine instance setup at https://console.cloud.google.com/appengine and try again. If this issue persists, please contact support.

Error: HTTP Error: 404, Could not find Application "second-project".

when I run $ firebase deploy.

I have added separate targets and a web app through Firebase console for the second project.

What should I be checking to get rid of this error?

Upvotes: 5

Views: 969

Answers (1)

brianbhsu
brianbhsu

Reputation: 710

I just ran into this same exact issue as well. Leaving this here for anyone that runs into this issue in the future. What caused this error for me was a permissions error, when Firebase tried to access specific resources in Google Cloud such as Cloud Functions without the necessary IAM/service accounts in place.

This happens when you create a new Firebase project without setting the Default GCP resource location under Settings > General in the Firebase Console, which occurs when you create a new Firebase project without doing any additional setup. You can set this in the settings or this is also set when you follow the walk-through instructions for setting up services such as Firestore or Firebase Storage in the Firebase console.

Without this set, the <YOUR_FIREBASE_PROJECT_NAME>@appspot.gserviceaccount.com IAM/service account will not be created in Google Cloud (which is needed to create/access specific resources), therefore when you run firebase deploy, it will fail with the error you mentioned above.

You can also check why your firebase deploy is failing in the firebase-debug.log that is generated when running this command (that's how I found out the cause of this error). Though I think this file is deleted after the command finishes execution, so you'll have to pipe the output into a file or save it some other way.

TL;DR: Set Default GCP resource location, one way this can be done is in the Firebase Console under Settings > General.

Upvotes: 7

Related Questions