aws / aws/aws-xray-sdk-node

TraceID - TypeError: Cannot read property 'FromString' of undefined

Open
#546 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
280
Forks
157
PR merge metrics
No merged PRs in 30d

Description

I'm trying to generate consistent Trace ID's across lambda invocations (in and event streaming platform).

However, I'm getting and error when calling static `FromString` method.

```
import * as AWSXray from 'aws-xray-sdk-core';

const foo = 'foo'
const bar = 'bar'

AWSXray.TraceID.FromString(`${foo}${bar}`).toString()

/**
* trace-id-test.ts:6
* AWSXray.TraceID.FromString(`${foo}${bar}`).toString()
* ^
* TypeError: Cannot read property 'FromString' of undefined
*/
```

and

```
import { TraceID } from 'aws-xray-sdk-core';

const foo = 'foo'
const bar = 'bar'

TraceID.FromString(`${foo}${bar}`).toString()

/**
* trace-id-test.ts:16
* TraceID.FromString(`${foo}${bar}`).toString()
* ^
* TypeError: Cannot read property 'FromString' of undefined
*/

```

As best I can tell, I'm following the implementation in the tests: https://github.com/aws/aws-xray-sdk-node/blob/master/packages/core/test-d/index.test-d.ts

Many thanks for any pointers and help!

node -v v14.19.3
aws-xray-sdk-core ^3.4.0

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction in the issue and compare the runtime exports against packages/core/test-d/index.test-d.ts, which the report cites. Verify whether TraceID and its FromString method are available at runtime in aws-xray-sdk-core 3.4.0; done means the runtime behavior matches the documented TypeScript surface, or the limitation is clearly documented with a focused test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.