question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code in schematics/deploy/builder.ts is preventing the usage of any non-default firebaseProject and firebaseHostingSite values

See original GitHub issue

Version info

Angular: 13.0.3

Firebase: 0.22.0

AngularFire: 7.2.0

Other (e.g. Ionic/Cordova, Node, browser, operating system): Node: v16.13.0

How to reproduce these conditions

Trying to accomplish working with multiple firebase projects for deployment as per instructions here: https://stackblitz.com/edit/angular-fire-start

Steps to set up and reproduce

When I try to set the different configurations for deploy command - for example:

 "deploy": {
     "builder": "@angular/fire:deploy",
      "options": {
          "prerender": false,
          "ssr": false,
          "browserTarget": "mypage:build:staging",
          "firebaseProject": "mypage-stg",
          "firebaseHostingSite": "mypage-stg"
      },
      "configurations": {
          "production": {
             "browserTarget": "mypage:build:production",
             "firebaseProject": "mypage-prod",
             "firebaseHostingSite": "mypage-prod"
          }
      }
}

And then run: ng deploy --configuration="production"

This results with error: An unhandled exception occurred: The Firebase Project specified by your angular.json or .firebaserc is in conflict

Debug output

An unhandled exception occurred: The Firebase Project specified by your angular.json or .firebaserc is in conflict

Looking at the text I identified the issues being the lines 25 and 33 in this file: https://github.com/angular/angularfire/blob/master/src/schematics/deploy/builder.ts

Problematic code parts:

 if (!firebaseProject) {
    throw new Error('Cannot detirmine the Firebase Project from your angular.json or .firebaserc');
}
if (firebaseProject !== defaultFirebaseProject) {
    throw new Error('The Firebase Project specified by your angular.json or .firebaserc is in conflict');
}

and

const firebaseHostingSite = options.firebaseHostingSite || defulatFirebaseHostingSite;
if (!firebaseHostingSite) {
    throw new Error(`Cannot detirmine the Firebase Hosting Site from your angular.json or .firebaserc`);
}
if (firebaseHostingSite !== defulatFirebaseHostingSite) {
    throw new Error('The Firebase Hosting Site specified by your angular.json or .firebaserc is in conflict');
}

I can not make the sense out of this code. Why would you prevent deploying any other value of the configuration other the default value?

Commenting out lines 25 and 33 results in the successful deployment of the desired configuration.

Expected behaviour

Being able to configure different firebase projects and hosting sites for the same project

Actual behaviour

Throwing errors when trying to use firebaseProject and firebaseHostingSite different from defaultFirebaseProject and defulatFirebaseHostingSite.

Edit: Duplicate of https://github.com/angular/angularfire/issues/3076 -> for some reason I thought that one was already closed

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:5

github_iconTop GitHub Comments

1reaction
gulandscommented, Sep 25, 2022

Any solution to this problem?

1reaction
sidsaxena0commented, Jun 21, 2022

Is there any workaround to this, I am scratching my head for last two days over this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get started with Firebase Hosting - Google
Select a Firebase project to connect to your local project directory. The selected Firebase project is your "default" Firebase project for your local...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found