Skip to content

Deploying to multiple firebase sites using angularFire and ng deploy #3309

Open
@h11a

Description

@h11a

Versions:
"@angular/cli": "^14.2.10",
"@angular/cdk": "^14.2.1",
"@angular/fire": "^7.4.1",
"firebase": "^9.6.8",

I am having issues with setting up config to allow deploying to a dev/prod sites on Firebase hosting. The sites on firebase are in the same firebase project

I have followed this guide
https://github.com/angular/angularfire/blob/master/docs/deploy/getting-started.md

but I am receiving the same issue as these old unanswered github issues
#3077

#3076

Here is my setup

  1. angular.json
   "deploy": {
                    "builder": "@angular/fire:deploy",
                    "options": {
                        "firebaseProject": "<<MY_FIREBASE_PROJECT_ID>>",
                        "siteTarget": "devTarget",
                        "buildTarget": "<<MY_ANGULAR_PROJECT>>:build:development"
                    },
                    "configurations": {
                        "dev": {
                            "firebaseProject": "<<MY_FIREBASE_PROJECT_ID>>",
                            "siteTarget": "devTarget",
                            "buildTarget": "<<MY_ANGULAR_PROJECT>>:build:development"
                        },
                        "prod": {
                            "firebaseProject": "<<MY_FIREBASE_PROJECT_ID>>",
                            "siteTarget": "prodTarget",
                            "buildTarget": "<<MY_ANGULAR_PROJECT>>:build:development"
                        }
                    }
                }
            }
  1. firebase.json
{
    "hosting": [
        {
            "target": "devTarget",
            "public": "dist",
            "ignore": [
                "**/.*"
            ]
        },
        {
            "target": "prodTarget",
            "public": "dist",
            "ignore": [
                "**/.*"
            ]
        }
    ]
}
  1. .firebaserc
{
  "projects": {
    "default": "<<MY_FIREBASE_PROJECT_ID>>"
  },
  "targets": {
    "<<MY_FIREBASE_PROJECT_ID>>": {
      "hosting": {
        "devTarget": [
          "<<DEV_SITE_ID>>"
        ],
        "prodTarget": [
          "<<PROD_SITE_ID>>"
        ]
      }
    },
  "etags": {}
}

Should this work if i run ng deploy <<MY_ANGULAR_PROJECT>> --configuration='dev'?

I receive the following error from node_modules\@angular\fire\schematics\deploy\builder.js:36:15

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions