Skip to content

doc(tls): tls.connect() supports timeout option but it is undocumented and misleadingly described #61075

@ikeyan

Description

@ikeyan

Affected URL(s)

https://nodejs.org/api/tls.html#tlsconnectoptions-callback

Description of the problem

tls.connect() supports the timeout option, but it is currently undocumented in the API reference.
Although the history indicates that timeout support was added in v11.8.0, v10.16.0, the corresponding documentation entry was later accidentally removed. As a result, the current docs are incomplete and misleading.

Actual Behavior

  • tls.connect({ timeout }) works as expected and is supported in practice
  • But it is not documented anywhere in the current API reference

Expected Behavior

Explicitly document the timeout option in tls.connect() options.

Background

Historically, when timeout support was introduced to tls.connect(), it was properly documented.
However, in a later commit, the documentation was removed unintentionally:

Documentation removal commit: ff8539e

Currently, the tls.connect() options section contains the following description:

…: Any socket.connect() option not already listed.

This wording strongly suggests that timeout is inherited from socket.connect().
However, this is incorrect:

  • timeout is not an option of socket.connect()
  • timeout is defined on net.createConnection(options[, connectListener])

This mismatch makes it very easy for users to misinterpret where timeout support comes from and whether it is officially supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions