Skip to content

Commit 3041fee

Browse files
committed
Merge branch 'dl-entrypoint' of https://github.com/firebase/firebase-functions into dl-entrypoint
2 parents c2ce100 + 284da5d commit 3041fee

File tree

20 files changed

+378
-152
lines changed

20 files changed

+378
-152
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
- Future Extensions support (#1590)
1+
- Fix retry in event triggered functions. (#1463)
2+
- Expose retry configuration in v2 RTDB trigger (#1588)
3+
- Fix CORS options for v2 callable functions (#1564)
4+
- Remove invalid `enforceAppCheck` option for v2 onRequest trigger (#1477)

package-lock.json

Lines changed: 316 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase-functions",
3-
"version": "5.0.1",
3+
"version": "5.1.0",
44
"description": "Firebase SDK for Cloud Functions",
55
"keywords": [
66
"firebase",

scripts/publish-container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:14
1+
FROM node:20
22

33
# Install dependencies
44
RUN apt-get update && \

spec/v2/providers/database.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,40 @@ describe("database", () => {
280280
},
281281
});
282282
});
283+
284+
it("should supply retry", () => {
285+
const func = database.onChangedOperation(
286+
database.writtenEventType,
287+
{
288+
ref: "/foo/{path=**}/{bar}/",
289+
instance: "my-instance",
290+
region: "us-central1",
291+
cpu: "gcf_gen1",
292+
minInstances: 2,
293+
retry: true,
294+
},
295+
() => 2
296+
);
297+
298+
expect(func.__endpoint).to.deep.equal({
299+
...MINIMAL_V2_ENDPOINT,
300+
platform: "gcfv2",
301+
cpu: "gcf_gen1",
302+
minInstances: 2,
303+
region: ["us-central1"],
304+
labels: {},
305+
eventTrigger: {
306+
eventType: database.writtenEventType,
307+
eventFilters: {
308+
instance: "my-instance",
309+
},
310+
eventFilterPathPatterns: {
311+
ref: "foo/{path=**}/{bar}",
312+
},
313+
retry: true,
314+
},
315+
});
316+
});
283317
});
284318

285319
describe("onOperation", () => {

src/logger/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ function removeCircular(obj: any, refs: any[] = []): any {
8787
* @public
8888
*/
8989
export function write(entry: LogEntry) {
90+
const ctx = traceContext.getStore();
91+
if (ctx?.traceId) {
92+
entry[
93+
"logging.googleapis.com/trace"
94+
] = `projects/${process.env.GCLOUD_PROJECT}/traces/${ctx.traceId}`;
95+
}
96+
9097
UNPATCHED_CONSOLE[CONSOLE_SEVERITY[entry.severity]](JSON.stringify(removeCircular(entry)));
9198
}
9299

@@ -147,17 +154,13 @@ function entryFromArgs(severity: LogSeverity, args: any[]): LogEntry {
147154
if (lastArg && typeof lastArg === "object" && lastArg.constructor === Object) {
148155
entry = args.pop();
149156
}
150-
const ctx = traceContext.getStore();
151157

152158
// mimic `console.*` behavior, see https://nodejs.org/api/console.html#console_console_log_data_args
153159
let message = format(...args);
154160
if (severity === "ERROR" && !args.find((arg) => arg instanceof Error)) {
155161
message = new Error(message).stack || message;
156162
}
157163
const out: LogEntry = {
158-
"logging.googleapis.com/trace": ctx?.traceId
159-
? `projects/${process.env.GCLOUD_PROJECT}/traces/${ctx.traceId}`
160-
: undefined,
161164
...entry,
162165
severity,
163166
};

src/params/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ export const storageBucket: Param<string> = new InternalExpression(
111111

112112
/**
113113
* Declares a secret param, that will persist values only in Cloud Secret Manager.
114-
* Secrets are stored interally as bytestrings. Use `ParamOptions.as` to provide type
114+
* Secrets are stored internally as bytestrings. Use `ParamOptions.as` to provide type
115115
* hinting during parameter resolution.
116116
*
117117
* @param name The name of the environment variable to use to load the parameter.
118-
* @param options Configuration options for the parameter.
119118
* @returns A parameter with a `string` return type for `.value`.
120119
*/
121120
export function defineSecret(name: string): SecretParam {

src/params/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ type ParamValueType = "string" | "list" | "boolean" | "int" | "float" | "secret"
175175
/** Create a select input from a series of values. */
176176
export function select<T>(options: T[]): SelectInput<T>;
177177

178-
/** Create a select input from a map of labels to vaues. */
178+
/** Create a select input from a map of labels to values. */
179179
export function select<T>(optionsWithLabels: Record<string, T>): SelectInput<T>;
180180

181181
/** Create a select input from a series of values or a map of labels to values */

src/v1/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function resetCache(): void {
3737
* Store and retrieve project configuration data such as third-party API
3838
* keys or other settings. You can set configuration values using the
3939
* Firebase CLI as described in
40-
* [Environment Configuration](/docs/functions/config-env).
40+
* https://firebase.google.com/docs/functions/config-env.
4141
*/
4242
export function config(): Record<string, any> {
4343
// K_CONFIGURATION is only set in GCFv2

src/v2/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export interface GlobalOptions {
135135
* The minimum timeout for a 2nd gen function is 1s. The maximum timeout for a
136136
* function depends on the type of function: Event handling functions have a
137137
* maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
138-
* maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
138+
* maximum timeout of 3,600s (1 hour). Task queue functions have a maximum
139139
* timeout of 1,800s (30 minutes).
140140
*/
141141
timeoutSeconds?: number | Expression<number> | ResetValue;

0 commit comments

Comments
 (0)