angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

`ng deploy` infinite setup loop

Open ersimont opened this issue 1 year ago • 5 comments

Version info

Angular: 18.0.3

Firebase: ??

AngularFire: 18.0.1

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

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

This involves running the schematics, so stackblitz doesn't help.

Steps to set up and reproduce

Follow the steps in these docs. I.e.:

  1. ng new the-project, choose default options
  2. cd the-project
  3. ng add @angular/fire choose Performance Monitoring (I don't want any of them actually. I only want to deploy. But I had even worse luck if I chose nothing - so this is a semi-random choice.)
    • At this point the doc says it should have created a .firebaserc file updated angular.json, but neither of these are true
  4. ng deploy
    • Here it asks me what to use to deploy. I choose "Firebase" and it simply loops me through the setup steps again, never deploying.

Sample data and security rules

Debug output

** Errors in the JavaScript console ** None

** Output from firebase.database().enableLogging(true); ** I'm not running the app, so I don't think this applies.

** Screenshots ** None

Expected behavior

I can use schematics to set up firebase hosting.

Actual behavior

Schematics do not set up firebase hosting. Instead every time I try to deploy it loops me back through the setup process.

ersimont avatar Jun 09 '24 12:06 ersimont

Can reproduce it here too. After running ng deploy, this is the output after selecting a project + app to deploy:

Cannot find "deploy" target for the specified project.
You can add a package that implements these capabilities.

For example:
  Amazon S3: ng add @jefiozie/ngx-aws-deploy
  Firebase: ng add @angular/fire
  Netlify: ng add @netlify-builder/deploy
  GitHub Pages: ng add angular-cli-ghpages

 Would you like to add a package with "deploy" capabilities now? Firebase
Skipping installation: Package already installed
UPDATE package.json (1345 bytes)
✔ Packages installed successfully.
? What features would you like to setup? Google Analytics
Using firebase-tools version 13.14.2
? Which Firebase account would you like to use? [email protected]
✔ Preparing the list of your Firebase projects
? Please select a project: dlj95-angular-firebase-deploy
✔ Preparing the list of your Firebase WEB apps
? Please select an app: angular-firebase-deploy
✔ Downloading configuration data of your Firebase WEB app
UPDATE src/app/app.config.ts (1456 bytes)
 ELIFECYCLE  Command failed with exit code 1.

If running ng deploy again, same happens

Some notes about the setup:

  • Both project and app are freshly created
  • Chose "Google Analytics" as feature when creating the project.
    • Despite I didn't want that feature. Just wanted to deploy the app
    • Anyways... 👇
  • The project creation step failed. Had to create it through the website.

I think there are two issues here also:

  1. Not being able to successfully deploy on a fresh app by running ng deploy and choosing Firebase (this setup loop)
  2. Having to select a Firebase feature. If you don't select any, the process is interrupted. What if I just want to use Firebase for deployment?

More details:

Angular `ng version` output

[email protected] ng /Users/davidlj95/Code/git/tmp/angular-firebase-deploy ng "version"

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/

Angular CLI: 18.1.2 Node: 20.12.0 Package Manager: pnpm 9.6.0 OS: darwin arm64

Angular: 18.1.2 ... animations, cli, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, platform-server ... router, ssr

Package Version

@angular-devkit/architect 0.1801.2 @angular-devkit/build-angular 18.1.2 @angular-devkit/core 18.1.2 @angular-devkit/schematics 18.1.2 @angular/fire 18.0.1 @schematics/angular 18.1.2 rxjs 7.8.1 typescript 5.5.4 zone.js 0.14.8

davidlj95 avatar Jul 30 '24 14:07 davidlj95

This is still an issue (more than two months after the original post).

I've tried using Angular v18 and v17, also tried on Mac and Windows and angularfire is not setting up the deploy configuration in angular.json at all. I have tried using Node versions 18.13.0, 18.16.0 and 18.19.1.

As a workaround I was able to copy configuration from a previous project and amend it for my new project, specifically:

  • the deploy section in angular.json
  • the contents of firebase.json
  • the .firebase.rc file

andreasvg avatar Aug 21 '24 15:08 andreasvg

still happening with lates setup of angular and angular/fire

technokon avatar Sep 12 '24 02:09 technokon

@andreasvg Could you post example code snippets of those three files please?

I've found several varying examples via google, but none work.

grantoverby avatar Jan 09 '25 13:01 grantoverby

Same issue for me. I was able to setup the deploy using firebase-tools instead.

mackermand avatar Jan 11 '25 16:01 mackermand