Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
65e0c59
Zip deploy fixes
annajowang Nov 22, 2025
ecbbe5e
Merge branch 'master' into zip-deploy
annajowang Dec 2, 2025
60adf94
use staging and specify uploading TAR
annajowang Dec 2, 2025
bcf0cd3
Improve docs
falahat Feb 2, 2026
4603750
Allow reading of simple env vars (not secrets) and passing them down …
falahat Feb 2, 2026
eb89f6b
Add some fixes for npm parsing issues
falahat Feb 3, 2026
9470c3d
Adding various local fixes/hacks to make local builds work. It includes:
falahat Feb 3, 2026
269da87
Follow-up fixes for ensuring we have account access for cloud storage…
falahat Feb 4, 2026
92a3f49
formatting fixes
falahat Feb 4, 2026
76ef53a
Merge branch 'main' of github.com:firebase/firebase-tools into zip-de…
falahat Feb 4, 2026
340020f
Get rid of env override
falahat Feb 11, 2026
d5343bd
Temporarily add a test app to easily test changes
falahat Feb 11, 2026
e17f55c
For local builds, explicitly check for apphosting.yaml files (and all…
falahat Feb 13, 2026
8341bc4
Add hono to packages
falahat Feb 13, 2026
4ed3b41
Merge branch 'main' of github.com:firebase/firebase-tools into zip-de…
falahat Feb 13, 2026
b76fa54
Merge branch 'main' of github.com:firebase/firebase-tools into zip-de…
falahat Feb 13, 2026
31fed5d
Merge branch 'zip-deploy' of github.com:firebase/firebase-tools into …
falahat Feb 13, 2026
2f653ca
Merge branch 'main' of github.com:firebase/firebase-tools into zip_de…
falahat Mar 9, 2026
b19b8bf
Get rid of test app
falahat Mar 9, 2026
611f258
Get rid of uniformBucketLevelAccess config which was not required
falahat Mar 9, 2026
37bb714
Fix tarball unit test
falahat Mar 9, 2026
1df73d7
Make local builds less hardcoded by checking if the build config is a…
falahat Mar 9, 2026
7d61148
Add a new experiment flag to control local builds (apphostinglocalbui…
falahat Mar 9, 2026
0ec1b92
Remove references to runtime flag
falahat Mar 9, 2026
2ea831d
Merge branch 'main' into zip_deploy_aryanf
falahat Mar 10, 2026
d20b46c
Merge branch 'main' of github.com:firebase/firebase-tools into zip_de…
falahat Mar 13, 2026
25262ac
Clean up the PR so that we gate by apphostinglocalbuilds experiment m…
falahat Mar 13, 2026
2f63f7a
Make the code for adding service account IAM permission more restrict…
falahat Mar 13, 2026
de4f95b
remove es2020 dependency
falahat Mar 13, 2026
0b4c052
Merge branch 'main' of github.com:firebase/firebase-tools into zip_de…
falahat Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 151 additions & 23 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@
]
},
"dependencies": {
"@apphosting/build": "^0.1.6",
"@apphosting/common": "^0.0.8",
"@apphosting/build": "^0.1.7",
"@electric-sql/pglite": "^0.3.3",
"@electric-sql/pglite-tools": "^0.2.8",
"@google-cloud/cloud-sql-connector": "^1.3.3",
Expand Down Expand Up @@ -167,6 +166,7 @@
"stream-chain": "^2.2.4",
"stream-json": "^1.7.3",
"superstatic": "^10.0.0",
"tar": "^7.5.11",
"tcp-port-used": "^1.0.2",
"tmp": "^0.2.3",
"triple-beam": "^1.3.0",
Expand Down
27 changes: 27 additions & 0 deletions src/apphosting/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
iamOrigin,
secretManagerOrigin,
} from "../api";
import { logger } from "../logger";
import { Backend, BackendOutputOnlyFields, API_VERSION } from "../gcp/apphosting";
import { addServiceAccountToRoles } from "../gcp/resourceManager";
import * as iam from "../gcp/iam";
Expand Down Expand Up @@ -49,7 +50,7 @@
// SSL.
const maybeNodeError = err as { cause: { code: string }; code: string };
if (
/HANDSHAKE_FAILURE/.test(maybeNodeError?.cause?.code) ||

Check warning on line 53 in src/apphosting/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Use `String#includes()` method with a string instead
"EPROTO" === maybeNodeError?.code
) {
return false;
Expand Down Expand Up @@ -272,6 +273,32 @@
await githubConnections.linkGitHubRepository(projectId, location, connectionId);
}

/**
* Ensures that the App Hosting service agent has the necessary permissions to
* manage resources in the project.
*/
export async function ensureAppHostingServiceAgentRoles(
projectId: string,
projectNumber: string,
): Promise<void> {
const p4saEmail = apphosting.serviceAgentEmail(projectNumber);
try {
await addServiceAccountToRoles(
projectId,
p4saEmail,
["roles/storage.objectViewer"],
/* skipAccountLookup= */ true,
);
} catch (err: unknown) {
logger.debug(`Failed to grant storage.objectViewer to ${p4saEmail}: ${err}`);

Check warning on line 293 in src/apphosting/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "unknown" of template literal expression
// We don't want to fail the entire prepare step if this fails, as it might
// be due to insufficient permissions to grant roles.
logWarning(
`Unable to verify App Hosting service agent permissions for ${p4saEmail}. If you encounter a PERMISSION_DENIED error during rollout, please ensure the service agent has the "Storage Object Viewer" role.`,
);
}
}

/**
* Ensures the service account is present the user has permissions to use it by
* checking the `iam.serviceAccounts.actAs` permission. If the permissions
Expand Down Expand Up @@ -315,7 +342,7 @@
* Prompts the user for a backend id and verifies that it doesn't match a pre-existing backend.
*/
export async function promptNewBackendId(projectId: string, location: string): Promise<string> {
while (true) {

Check warning on line 345 in src/apphosting/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected constant condition
const backendId = await input({
default: "my-web-app",
message: "Provide a name for your backend [1-30 characters]",
Expand Down Expand Up @@ -624,7 +651,7 @@
message: locationDisambugationPrompt,
choices: [...backendsByLocation.keys()],
});
return backendsByLocation.get(location)!;

Check warning on line 654 in src/apphosting/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Forbidden non-null assertion
}

/**
Expand Down
21 changes: 21 additions & 0 deletions src/apphosting/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,27 @@
});
});

describe("splitEnvVars", () => {
it("should stringify numeric values", () => {
const env: AppHostingYamlConfig["env"] = {
STR: { value: "string" },
NUM: { value: 12345 as any },

Check warning on line 480 in src/apphosting/config.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 480 in src/apphosting/config.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
BUILD_AND_RUNTIME_NUM: { value: 67890 as any, availability: ["BUILD", "RUNTIME"] },

Check warning on line 481 in src/apphosting/config.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 481 in src/apphosting/config.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
};

const { build, runtime } = config.splitEnvVars(env);

expect(build["BUILD_AND_RUNTIME_NUM"].value).to.equal("67890");
expect(runtime).to.deep.include({ variable: "STR", value: "string" });
expect(runtime).to.deep.include({ variable: "NUM", value: "12345" });
expect(runtime).to.deep.include({
variable: "BUILD_AND_RUNTIME_NUM",
value: "67890",
availability: ["BUILD", "RUNTIME"],
});
});
});

describe("getAppHostingConfiguration", () => {
let loadAppHostingYamlStub: sinon.SinonStub;
let listAppHostingFilesInPathStub: sinon.SinonStub;
Expand Down
Loading
Loading