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

Cannot set properties of undefined (setting 'namespace') 3.7.0 error #655

Closed
daanootje opened this issue Jun 6, 2024 · 1 comment
Closed

Comments

@daanootje
Copy link

Could be a duplicate of #654. After recently changing to 3.7.0 we are encountering the following error:

2024-06-06T10:52:44.066Z | INIT_START Runtime Version: nodejs:18.v29 Runtime Version
2024-06-06T10:52:44.895Z | undefined ERROR _X_AMZN_TRACE_ID is missing required information
2024-06-06T10:52:44.896Z | undefined ERROR Empty or non-string trace ID provided
2024-06-06T10:52:45.750Z | START RequestId: 60bee989-dc24-514d-a1cc-b7524b09db45
2024-06-06T10:52:46.105Z	| ERROR	Invoke Error 	
{
    "errorType": "RequestError",
    "errorMessage": "Cannot set properties of undefined (setting 'namespace')",
    "code": "ERR_GOT_REQUEST_ERROR",
    "name": "RequestError",
    "stack": [
        "RequestError: Cannot set properties of undefined (setting 'namespace')",
        "    at captureOutgoingHTTPs (/var/task/node_modules/aws-xray-sdk-core/dist/lib/patchers/http_p.js:108:30)",
        "    at Object.captureHTTPsRequest [as request] (/var/task/node_modules/aws-xray-sdk-core/dist/lib/patchers/http_p.js:175:16)",
        "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
    ]
}
2024-06-06T10:52:46.109Z | END RequestId: 60bee989-dc24-514d-a1cc-b7524b09db45 
2024-06-06T10:52:46.109Z | REPORT RequestId: 60bee989-dc24-514d-a1cc-b7524b09db45	Duration: 359.46 ms	Billed Duration: 360 ms	Memory Size: 1024 MB	Max Memory Used: 137 MB	Init Duration: 1683.30 ms	
XRAY TraceId: 1-666194fb-4d3d1850fcf803f9e905fdf7	SegmentId: 161caf1c19d1cbf2	Sampled: true	

The code tries to bind the xray trace id to an outgoing http request.

import * as awsXRay from 'aws-xray-sdk-core'
import https from 'https'

const enableTracing = true

export function makeXrayHttps({ enableTracing }: { enableTracing: boolean }) {
    return enableTracing ? awsXRay.captureHTTPs(https, true) : https // <-- Most likely failing here
}

const xrayHttps = makeXrayHttps({ enableTracing })
@wangzlei
Copy link
Contributor

wangzlei commented Jun 6, 2024

The PR introduced the issue has been reverted by #657
Please bump to the latest 3.8.0 with the fix.

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

2 participants