Describe the bug
The google.nodejs.turborepo buildpack (v0.0.1) fails to respect the GOOGLE_BUILDABLE environment variable when running in Firebase App Hosting, causing it to target the root package name instead of the intended workspace application.
Additional context
How are you using GCP buildpacks?
Did this used to work?
No. The bug is reproducible every time the turborepo buildpack participates in a Firebase App Hosting build where GOOGLE_BUILDABLE points to a sub-directory workspace application.
What language is your project primarily written in?
Node.js (Next.js 16.2.3, Turborepo 2.9.6, npm workspaces)
Steps To Reproduce
- Create a standard npm-workspace Turborepo monorepo:
workspaces: ["apps/*", "packages/*"]
- Place
turbo.json at the repo root.
- Create a Next.js app in
apps/web with package.json name @meandma/web.
- Ensure the root
package.json has a different name (e.g. meandma) and is not included in workspaces.
- Configure Firebase App Hosting with:
firebase.json: rootDir: "."
apphosting.yaml: GOOGLE_BUILDABLE=apps/web
- Push to trigger a deployment.
Expected behavior
The turborepo buildpack should read GOOGLE_BUILDABLE=apps/web, resolve the package.json at apps/web/package.json, and execute:
turbo run build --filter=@meandma/web --env-mode=loose
Actual behavior
The buildpack targets the root package name instead:
• turbo 2.9.6
x No package found with name 'meandma' in workspace
It appears to be running turbo run build --filter=meandma, ignoring the GOOGLE_BUILDABLE value entirely.
Build Log Excerpt
Step #1 - "preparer": - variable: GOOGLE_BUILDABLE
Step #1 - "preparer": value: apps/web
...
Step #3 - "build": === Node.js - Turborepo Using Runner (google.nodejs.turborepo@0.0.1) ===
...
Step #3 - "build": • turbo 2.9.6
Step #3 - "build": x No package found with name 'meandma' in workspace
Full error from Cloud Build:
Error: Build process exited with error code 1.
Root Cause Analysis
Looking at the buildpack source (cmd/nodejs/turborepo/lib/lib.go), BuildFn calls util.ApplicationDirectory(ctx), which is supposed to check env.Buildable (GOOGLE_BUILDABLE) and return the subdirectory path. However, ApplicationDirectory uses os.LookupEnv, which only reads the OS process environment. In Firebase App Hosting, GOOGLE_BUILDABLE is injected via the buildpack platform environment (BuildContext.Platform.Environment), so the resolution falls back to ctx.ApplicationRoot(). This causes appPackageJSON to be read from the root package.json (name: meandma) rather than apps/web/package.json (name: @meandma/web).
Workaround
Rename turbo.json to turbo.jsonc (which Turbo CLI supports but the buildpack does not detect). This prevents google.nodejs.turborepo from participating in the build. The google.nodejs.firebasenextjs buildpack then falls back to the root build script, which can handle the monorepo build correctly.
Describe the bug
The
google.nodejs.turborepobuildpack (v0.0.1) fails to respect theGOOGLE_BUILDABLEenvironment variable when running in Firebase App Hosting, causing it to target the root package name instead of the intended workspace application.Additional context
How are you using GCP buildpacks?
packand thegcr.io/buildpacks/builderDid this used to work?
No. The bug is reproducible every time the turborepo buildpack participates in a Firebase App Hosting build where
GOOGLE_BUILDABLEpoints to a sub-directory workspace application.What language is your project primarily written in?
Node.js (Next.js 16.2.3, Turborepo 2.9.6, npm workspaces)
Steps To Reproduce
workspaces: ["apps/*", "packages/*"]turbo.jsonat the repo root.apps/webwithpackage.jsonname@meandma/web.package.jsonhas a different name (e.g.meandma) and is not included inworkspaces.firebase.json:rootDir: "."apphosting.yaml:GOOGLE_BUILDABLE=apps/webExpected behavior
The turborepo buildpack should read
GOOGLE_BUILDABLE=apps/web, resolve thepackage.jsonatapps/web/package.json, and execute:Actual behavior
The buildpack targets the root package name instead:
It appears to be running
turbo run build --filter=meandma, ignoring theGOOGLE_BUILDABLEvalue entirely.Build Log Excerpt
Full error from Cloud Build:
Root Cause Analysis
Looking at the buildpack source (
cmd/nodejs/turborepo/lib/lib.go),BuildFncallsutil.ApplicationDirectory(ctx), which is supposed to checkenv.Buildable(GOOGLE_BUILDABLE) and return the subdirectory path. However,ApplicationDirectoryusesos.LookupEnv, which only reads the OS process environment. In Firebase App Hosting,GOOGLE_BUILDABLEis injected via the buildpack platform environment (BuildContext.Platform.Environment), so the resolution falls back toctx.ApplicationRoot(). This causesappPackageJSONto be read from the rootpackage.json(name:meandma) rather thanapps/web/package.json(name:@meandma/web).Workaround
Rename
turbo.jsontoturbo.jsonc(which Turbo CLI supports but the buildpack does not detect). This preventsgoogle.nodejs.turborepofrom participating in the build. Thegoogle.nodejs.firebasenextjsbuildpack then falls back to the rootbuildscript, which can handle the monorepo build correctly.