From a64fd48fac12cd6293885ec8402a334037470c44 Mon Sep 17 00:00:00 2001 From: blidd-google <112491344+blidd-google@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:02:57 -0500 Subject: [PATCH] Wrap 2nd gen onCall functions with trace context (#1491) * wrap oncall functions with trace context --- CHANGELOG.md | 1 + src/v2/providers/https.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb..35533aa31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Wrap 2nd gen onCall functions with trace context. (#1491) diff --git a/src/v2/providers/https.ts b/src/v2/providers/https.ts index 466160d62..178ee929a 100644 --- a/src/v2/providers/https.ts +++ b/src/v2/providers/https.ts @@ -366,7 +366,7 @@ export function onCall>( // onCallHandler sniffs the function length to determine which API to present. // fix the length to prevent api versions from being mismatched. const fixedLen = (req: CallableRequest) => handler(req); - const func: any = onCallHandler( + let func: any = onCallHandler( { cors: { origin, methods: "POST" }, enforceAppCheck: opts.enforceAppCheck ?? options.getGlobalOptions().enforceAppCheck, @@ -375,6 +375,8 @@ export function onCall>( fixedLen ); + func = wrapTraceContext(func); + Object.defineProperty(func, "__trigger", { get: () => { const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());