Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch calls with anything but a request object will execute without the x-amzn-trace-id header #679

Open
berndfuhrmann opened this issue Sep 17, 2024 · 0 comments

Comments

@berndfuhrmann
Copy link

Consider this code

import AWSXRay from 'aws-xray-sdk-core';
import { captureFetchGlobal } from 'aws-xray-sdk-fetch';

captureFetchGlobal();

var segment = new AWSXRay.Segment('test');
var ns = AWSXRay.getNamespace();

ns.run(async function () {
  AWSXRay.setSegment(segment);
  fetch('http://localhost:3000')
  segment.close();
});

I would expect localhost:3000 to receive the x-amzn-trace-id header, but it doesn't.
When changing the fetch call like this: fetch(new Request("http://localhost:3000")); it works.
Working on a PR to fix this.

berndfuhrmann added a commit to berndfuhrmann/aws-xray-sdk-node that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant