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

ProxyAgent ignores connect timeout options and lacks documentation for signal parameter #3944

Closed
timursevimli opened this issue Dec 12, 2024 · 2 comments · Fixed by #3945
Closed
Labels
bug Something isn't working

Comments

@timursevimli
Copy link
Contributor

timursevimli commented Dec 12, 2024

Bug Description

The connect options passed to ProxyAgent are being ignored, despite the type definitions suggesting they should work. This appears to be both a potential bug and a documentation issue.

Reproducible By

const { ProxyAgent } = require('undici');

const agent = new ProxyAgent({
  uri: 'http://8.8.8.8:8000',
  connect: {
    signal: AbortSignal.timeout(100),
    timeout: 100,
  },
});

fetch('https://example.com', {
  dispatcher: agent,
})
  .then((res) => res.text())
  .then(console.log)
  .catch(console.error);

Current Behavior

The timeout and signal parameters in connect options are not being processed when passed to ProxyAgent

Expected Behavior

According to the documentation:

  • ProxyAgentOptions extends AgentOptions
  • AgentOptions extends PoolOptions
  • PoolOptions extends ClientOptions
  • ClientOptions includes connect parameter which accepts ConnectOptions

Therefore, the timeout and signal options should work when passed through the connect parameter.

Relevant Documentation Links

@timursevimli timursevimli added the bug Something isn't working label Dec 12, 2024
@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@timursevimli
Copy link
Contributor Author

Yes, I will make a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants