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

Fix error due to undefined options #4022

Closed

Conversation

atif-saddique-deel
Copy link
Contributor

@atif-saddique-deel atif-saddique-deel commented Feb 2, 2024

What does this PR do?

TypeError: Cannot read properties of undefined (reading 'timeout')
    at HttpClientPlugin.error (/usr/src/app/node_modules/dd-trace/packages/datadog-plugin-http/src/client.js:125:39)
    at /usr/src/app/node_modules/dd-trace/packages/dd-trace/src/plugins/tracing.js:73:22
    at Subscription._handler (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/plugins/plugin.js:14:9)
    at Channel.publish (node:diagnostics_channel:141:9)
    at req.emit (/usr/src/app/node_modules/dd-trace/packages/datadog-instrumentations/src/http/client.js:101:30)
    at Socket.emitRequestTimeout (node:_http_client:847:9)
    at Object.onceWrapper (node:events:631:28)
    at Socket.emit (node:events:529:35)
    at Socket.emit (node:domain:552:15)
    at Socket.emit (/usr/src/app/node_modules/dd-trace/packages/datadog-instrumentations/src/net.js:61:25)
    at Socket._onTimeout (node:net:598:8)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

Motivation

There was a bug introduced in version v4.21.0 here and this PR fixes that bug.
Screenshot 2024-02-02 at 2 04 16 PM

Screenshot 2024-02-02 at 2 06 21 PM

Plugin Checklist

Additional Notes

Security

Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

When options are undefined, doing `options.timeout` throws error and crash the whole node process.
DataDog#3939
@simon-id
Copy link
Member

simon-id commented Feb 5, 2024

I've recreated your PR in #4029 to allow the CI to run. I've cherrypicked your commit so you keep authorship!

@simon-id simon-id closed this Feb 5, 2024
@atif-saddique-deel atif-saddique-deel deleted the patch-1 branch February 5, 2024 10:49
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

Successfully merging this pull request may close these issues.

2 participants