-
Notifications
You must be signed in to change notification settings - Fork 171
Closed
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedenhancementPRs that introduce minor changes, usually to existing featuresPRs that introduce minor changes, usually to existing featurestracerThis item relates to the Tracer UtilityThis item relates to the Tracer Utility
Description
Expected Behaviour
In our Team we use the native nodeJS 18 fetch module to make api calls.
We were expecting that fetch calls would be traced the same as they where when we used node-fetch
.
Current Behaviour
The fetch calls are not traced whereas the node-fetch calls are traced.
The x-ray traces show only the api calls made with node-fetch.
Code snippet
import { LambdaInterface } from "@aws-lambda-powertools/commons";
import { Tracer } from "@aws-lambda-powertools/tracer";
import nodeFetch from "node-fetch";
const tracer = new Tracer();
class Lambda implements LambdaInterface {
// Decorate your handler class method
@tracer.captureMethod()
private async nativeFetch() {
const response = await fetch("https://api.github.com/users/aws-samples");
const json = await response.json();
return json;
}
@tracer.captureMethod()
private async nodeFetch() {
const response = await nodeFetch(
"https://api.github.com/users/aws-samples"
);
const json = await response.json();
return json;
}
public async handler(_event: unknown, _context: unknown): Promise<void> {
await this.nativeFetch();
await this.nodeFetch();
}
}
const handlerClass = new Lambda();
export const handler = handlerClass.handler.bind(handlerClass); //
Steps to Reproduce
- clone the bug repo https://github.com/RaphaelManke/aws-powertools-node-18-tracing-fetch-bug
- npm install
- npm run cdk deploy
- invoke the lambda
Possible Solution
No response
Powertools for AWS Lambda (TypeScript) version
1.11.1
AWS Lambda function runtime
18.x
Packaging format used
npm
Execution logs
No response
felixmagnus, Mackie, marcelfrey29, nick-kang, kitonaoto and 8 more
Metadata
Metadata
Assignees
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedenhancementPRs that introduce minor changes, usually to existing featuresPRs that introduce minor changes, usually to existing featurestracerThis item relates to the Tracer UtilityThis item relates to the Tracer Utility
Type
Projects
Status
Shipped