Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Fixes issue with custom 404 pages not being returned in Next.js in the emulator (#8035).
- Annotate onCallGenkit functions to allow for future Firebase Console annotations (#8135)
3 changes: 0 additions & 3 deletions src/deploy/functions/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@

/** API agnostic version of a Firebase callable function. */
export type CallableTrigger = {
// NOTE: This is currently unused because GCF 2nd gen labels do not support
// the characterset that may be in a genkit action name.
// This should be set as a Cloud Run attribute once we move to Cloud Run Functions.
genkitAction?: string;
};

Expand Down Expand Up @@ -519,7 +516,7 @@
await loadExistingBackend(context);
}
// loadExisting guarantees the validity of existingBackend and unreachableRegions
return context.existingBackend!;

Check warning on line 519 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Forbidden non-null assertion
}

async function loadExistingBackend(ctx: Context): Promise<void> {
Expand Down Expand Up @@ -552,8 +549,8 @@
ctx.existingBackend.endpoints[endpoint.region][endpoint.id] = endpoint;
}
ctx.unreachableRegions.gcfV2 = gcfV2Results.unreachable;
} catch (err: any) {

Check warning on line 552 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (err.status === 404 && err.message?.toLowerCase().includes("method not found")) {

Check warning on line 553 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .status on an `any` value

Check warning on line 553 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .includes on an `any` value

Check warning on line 553 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value

Check warning on line 553 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value

Check warning on line 553 in src/deploy/functions/backend.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value
return; // customer has preview enabled without allowlist set
}
throw err;
Expand Down
17 changes: 17 additions & 0 deletions src/gcp/cloudfunctionsv2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ describe("cloudfunctionsv2", () => {
[BLOCKING_LABEL]: "before-sign-in",
},
});

expect(
cloudfunctionsv2.functionFromEndpoint({
...ENDPOINT,
platform: "gcfv2",
callableTrigger: {
genkitAction: "flows/flow",
},
}),
).to.deep.equal({
...CLOUD_FUNCTION_V2,
labels: {
...CLOUD_FUNCTION_V2.labels,
"deployment-callable": "true",
"genkit-action": "true",
},
});
});

it("should copy trival fields", () => {
Expand Down
3 changes: 3 additions & 0 deletions src/gcp/cloudfunctionsv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@
* @param type Type of deployment - create, update, or delete.
* @param err The error returned from the operation.
*/
function functionsOpLogReject(func: InputCloudFunction, type: string, err: any): void {

Check warning on line 252 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (err?.message?.includes("maxScale may not exceed")) {

Check warning on line 253 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value

Check warning on line 253 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value
const maxInstances = func.serviceConfig.maxInstanceCount || DEFAULT_MAX_INSTANCE_COUNT;
utils.logLabeledWarning(
"functions",
Expand Down Expand Up @@ -609,6 +609,9 @@
gcfFunction.labels = { ...gcfFunction.labels, "deployment-taskqueue": "true" };
} else if (backend.isCallableTriggered(endpoint)) {
gcfFunction.labels = { ...gcfFunction.labels, "deployment-callable": "true" };
if (endpoint.callableTrigger.genkitAction) {
gcfFunction.labels["genkit-action"] = "true";
}
} else if (backend.isBlockingTriggered(endpoint)) {
gcfFunction.labels = {
...gcfFunction.labels,
Expand Down
Loading