Skip to content

Commit a64fd48

Browse files
authoredNov 28, 2023
Wrap 2nd gen onCall functions with trace context (#1491)
* wrap oncall functions with trace context
1 parent 414ff0a commit a64fd48

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Wrap 2nd gen onCall functions with trace context. (#1491)

‎src/v2/providers/https.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export function onCall<T = any, Return = any | Promise<any>>(
366366
// onCallHandler sniffs the function length to determine which API to present.
367367
// fix the length to prevent api versions from being mismatched.
368368
const fixedLen = (req: CallableRequest<T>) => handler(req);
369-
const func: any = onCallHandler(
369+
let func: any = onCallHandler(
370370
{
371371
cors: { origin, methods: "POST" },
372372
enforceAppCheck: opts.enforceAppCheck ?? options.getGlobalOptions().enforceAppCheck,
@@ -375,6 +375,8 @@ export function onCall<T = any, Return = any | Promise<any>>(
375375
fixedLen
376376
);
377377

378+
func = wrapTraceContext(func);
379+
378380
Object.defineProperty(func, "__trigger", {
379381
get: () => {
380382
const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions());

0 commit comments

Comments
 (0)
Please sign in to comment.