Skip to content
Open
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
3 changes: 3 additions & 0 deletions kits/firestore-genai-chatbot/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,8 @@ export function envDeployOptions(): DeployTimeOptions {
// `.env`, the `{messageId}` wildcard stays literal (matches extension.yaml's
// `${COLLECTION_NAME}/{messageId}` trigger resource).
document: expr`${params.collectionName}/{messageId}`,
// extension.yaml sets `timeout: 540s`; without this the function takes
// the 60s default and long generations time out.
timeoutSeconds: 540,
};
}
2 changes: 2 additions & 0 deletions kits/firestore-genai-chatbot/src/export-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export interface ResolvedGenaiChatbotConfig {
export interface DeployTimeOptions {
/** Watched Firestore document/collection path for the trigger. */
document: string | Expression<string>;
/** Function timeout in seconds; extension.yaml sets `timeout: 540s`. */
timeoutSeconds: number;
}

/**
Expand Down
1 change: 1 addition & 0 deletions kits/firestore-genai-chatbot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const generateMessage = onDocumentWritten(
{
document: deployOptions.document,
secrets: [apiKeySecret],
timeoutSeconds: deployOptions.timeoutSeconds,
},
(event) => handleDocumentWrite(event, getContext())
);
4 changes: 4 additions & 0 deletions kits/firestore-genai-chatbot/tests/deploy-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ describe("envDeployOptions", () => {
expect(options).not.toHaveProperty("region");
});

test("declares the extension's 540s timeout", () => {
expect(options.timeoutSeconds).toBe(540);
});

test("document expression is not a frozen undefined/empty literal", () => {
expect(options.document).toBeInstanceOf(Expression);
expect(cel(options.document)).not.toContain("undefined");
Expand Down
Loading