We have an Angular 18 app that uses Git submodules:
.gitmodules
file:
[submodule "projects/shared-lib/src/whatever-lib"]
path = projects/shared-lib/src/whatever-lib
url = https://source.developers.google.com/p/whatever-project/r/angular-lib
branch = whatever-branch
We’re using Firebase App Hosting to deploy our app. We configured App Hosting according to the documentation for a basic example.
The problem: Cloud build is not downloading the submodules, so it fails with a lot of errors related to not finding references:
Error: ✘ [ERROR] TS2307: Cannot find module '@common/api-server' or its corresponding type declarations. [plugin angular-compiler]nn projects/shared-lib/src/lib/client/client-db.service.ts:6:47
(@common
points to projects/shared-lib/src
)
Submodules are hosted in Cloud Source Repositories on the same project. Just in case, we explicitly added the App Hosting service account (firebase-app-hosting-compute@whatever-project.iam.gserviceaccount.com
) to the repository users with Cloud Build Service Account
role.
By the Cloud Build logs, it doesn’t even seem to be trying to download the submodules before building.
What we found:
We’ve found similar issues here and here of people having the same problem with Cloud Build and Git submodules. The difference is that they’re using Cloud Build directly (instead of using App Hosting from Firebase), so they can add a step 0 to their cloudbuild.yaml
to download the submodules.
We don’t have that file. Adding cloudbuild.yaml
to the root of the project with that single step, doesn’t seem to have any effects.
Any ideas how to make Cloud Build download Git submodules when using Firebase App Hosting?