firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Unable to detect the web framework in use when using angular app within nx monorepo

Open kedevked opened this issue 2 years ago • 13 comments

[REQUIRED] Environment info

firebase-tools: 12.4.1

Platform: Windows wsl

[REQUIRED] Steps to reproduce

  • create an nx monorepo with an angular app:

    npx create-nx-workspace@latest

✔ Where would you like to create your workspace? · org ✔ Which stack do you want to use? · angular ✔ Standalone project or integrated monorepo? · integrated ✔ Application name · org ✔ Default stylesheet format · scss ✔ Would you like to use Standalone Components in your application? · Yes ✔ Would you like to add routing? · Yes ✔ Enable distributed caching to make your CI faster · No

npm install @angular/fire

npx nx g @angular/fire:ng-add

firebase deploy

[REQUIRED] Expected behavior

expect the app to be deployed to firebase

[REQUIRED] Actual behavior

throws error

Unable to detect the web framework in use

kedevked avatar Jun 28 '23 09:06 kedevked

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Jun 28 '23 09:06 google-oss-bot

I'm facing the same issue with NextJS and NX

robinstaudinger avatar Jul 04 '23 13:07 robinstaudinger

Monorepos are not officially supported https://github.com/firebase/firebase-tools/issues/653 You might be able to create a hack to get it working, but from my experience you're better of looking elsewhere for your monorepo hosting needs

borisyordanov avatar Jul 17 '23 07:07 borisyordanov

Given the popularity of nx within the JavaScript ecosystem tooling, I would be surprised if nx is officially not supported

kedevked avatar Jul 17 '23 16:07 kedevked

I also have the same problem. Maybe it can be fixed with an option to manually choose nextjs?

ibrahimAboelsuod avatar Jul 25 '23 14:07 ibrahimAboelsuod

This line - frameworks/angular/index.ts

It requires angular.json, if we can have that as parameter it might work!

ezzabuzaid avatar Aug 03 '23 21:08 ezzabuzaid

Is there an alternative to firebase which is supported for an Angular App within a NX Monorepo?

5ysc4ll avatar Aug 29 '23 20:08 5ysc4ll

This line - frameworks/angular/index.ts

It requires angular.json, if we can have that as parameter it might work!

Yeah I was looking at the source and it also required a package.json file ... which NX do not create in their app folder. So my hack was to copy project.json to angular.json and to put a "dummy" package.json file but you also need to perform npm i on your source folder otherwise you will face the next "check" that firebase tools is doing and it is to check if the command ng is available in the soruce folder ...

https://github.com/firebase/firebase-tools/blob/cf9379f89b20e8ea0cc36a485488399442155e4c/src/frameworks/utils.ts#L248

alexdabast avatar Dec 01 '23 10:12 alexdabast

Since Angular 17 and the SSR update, we have been using SSR and Firebase hosting. However, this is currently not possible as all our apps are in an NX monorepo. We are currently separating all apps into their own repositories, but this makes maintenance much more difficult due to common libraries. We would really appreciate a solution that is directly integrated into the Firebase CLI.

SvenBudak avatar Dec 21 '23 15:12 SvenBudak

Yeah, same here, it took me to long to find this thread, If this is not planned to be supported, I would at least expect some clear info in the doc stating that mono repo are not supported.

Crocsx avatar Jan 03 '24 03:01 Crocsx

We're using Angular 18 SSR with NX v19 and @alexdabast's solution is working but not sustainable. The project is recognized as a Vite project and it does not work. Are there any plans to support NX monorepos with Angular or any other project?

AlmaniaM avatar Sep 19 '24 03:09 AlmaniaM

@AlmaniaM we are now using firebase "App Hosting" feature and it supports everything We also move to pnpm who is also supported by app hosting

alexdabast avatar Sep 19 '24 07:09 alexdabast

@AlmaniaM we are now using firebase "App Hosting" feature and it supports everything We also move to pnpm who is also supported by app hosting

Interesting. I've been trying to get App Hosting to work but It keeps failing to deploy on the last step with no helpful logging either.

AlmaniaM avatar Sep 19 '24 07:09 AlmaniaM

@AlmaniaM we are now using firebase "App Hosting" feature and it supports everything We also move to pnpm who is also supported by app hosting

So does app hosting somehow support having multiple angular projects in one workspace? Can you elaborate a bit? Even trying App hosting, same error occurs in the cloud run log. It simply cannot handle 2 projects in one workspace...

Image

worthy7 avatar Mar 05 '25 06:03 worthy7