Skip to content

Getting timeout issue #2078

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

Open
depatla opened this issue Mar 1, 2025 · 2 comments
Open

Getting timeout issue #2078

depatla opened this issue Mar 1, 2025 · 2 comments

Comments

@depatla
Copy link

depatla commented Mar 1, 2025

Issue: datadog-api-client Failing with ETIMEDOUT, Direct API Calls Work

Description
I am facing an issue where API requests made using datadog-api-client fail with a timeout error (ETIMEDOUT) only on my deployed server. However, when I make direct API calls using Axios (e.g., https://api.datadoghq.com/api/v1/dashboard), it works fine.

Error fetching cluster metrics: FetchError: request to https://api.datadoghq.com/api/v1/query?from=1740660092&to=1740660152&query=sum%3Akubernetes.cpu.requests%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Akubernetes.cpu.limits%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Akubernetes.cpu.usage.total%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Akubernetes.memory.requests%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Akubernetes.memory.limits%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Akubernetes.memory.usage%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Asystem.cpu.num_cores%7B*%7D+by+%7Bcluster_name%7D%2C+avg%3Asystem.cpu.idle%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Asystem.mem.total%7B*%7D+by+%7Bcluster_name%7D%2C+sum%3Asystem.mem.free%7B*%7D+by+%7Bcluster_name%7D failed, reason: connect ETIMEDOUT 3.233.153.176:443
at ClientRequest. (/home/monitoring/app/node_modules/node-fetch/lib/index.js:1501:11)
at ClientRequest.emit (events.js:400:28)
at TLSSocket.socketErrorListener (_http_client.js:475:9)
at TLSSocket.emit (events.js:400:28)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT'
}

Observations
The issue only happens with datadog-api-client.
Direct API calls using Axios work fine.
Works locally, but fails when deployed.
Seems to be a connection issue (ETIMEDOUT), but only with the client library.
Expected Behavior
Requests using datadog-api-client should work in both local and deployed environments, just like direct API calls.

Steps to Reproduce
Deploy the application to a server.
Attempt to fetch cluster metrics using datadog-api-client.
Observe the timeout error.
Try the same request using Axios → Works fine.
Possible Causes
Proxy or network configuration: The client library might be using a proxy or network setting that causes issues on the server.
TLS or library-specific networking issues.
Different default timeouts or retry mechanisms in datadog-api-client vs. Axios.
Node.js version mismatch: The deployed environment may have a different version of Node.js affecting the behavior.
Workaround (Works with Axios)
const axios = require('axios');

axios.get('https://api.datadoghq.com/api/v1/dashboard', {
headers: {
'DD-API-KEY': 'xxx',
'DD-APPLICATION-KEY': 'xxx'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
This works fine, but datadog-api-client still fails.

Request for Help
Are there any known issues with datadog-api-client in a deployed environment?
Is there a recommended way to debug or configure the client for better connectivity?
Any guidance would be greatly appreciated. Thanks! 🙏

@jack-edmonds-dd
Copy link
Contributor

Hi @depatla,

We're not aware of any issues using the datadog-api-client-typescript package in a deployed environment. It could be an issue with some outgoing traffic configuration on your server.

Copy link

github-actions bot commented Apr 6, 2025

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants