Skip to content

fix(ext/node): use ERR_INVALID_ARG_TYPE for tls.createServer non-object options#33589

Merged
bartlomieju merged 1 commit intodenoland:mainfrom
nathanwhitbot:fix/node-compat-iter49
Apr 27, 2026
Merged

fix(ext/node): use ERR_INVALID_ARG_TYPE for tls.createServer non-object options#33589
bartlomieju merged 1 commit intodenoland:mainfrom
nathanwhitbot:fix/node-compat-iter49

Conversation

@nathanwhitbot
Copy link
Copy Markdown
Contributor

Summary

tls.createServer('this is not valid') was throwing a plain TypeError("options must be an object") with no code set. Match Node's lib/_tls_wrap.js so the rejection carries:

  • code: 'ERR_INVALID_ARG_TYPE'
  • message: 'The "options" argument must be of type object. Received type string (\'this is not valid\')'

Enables parallel/test-tls-no-cert-required.js.

Test plan

  • cargo test --test node_compat -- test-tls-no-cert-required (was failing on main, passes here)
  • cargo build --bin deno clean
  • tools/format.js and tools/lint.js --js clean
  • Sibling enabled TLS tests still pass: test-tls-basic-validations, test-tls-startcom-wosign-whitelist, test-tls-honorcipherorder, test-tls-add-context, test-tls-cert-regression, test-tls-check-server-identity.

…ct options

`tls.createServer('not an object')` was throwing a plain
`TypeError: options must be an object` with no `code` set. Match
Node's [`lib/_tls_wrap.js`](https://github.com/nodejs/node/blob/main/lib/_tls_wrap.js)
by raising `ERR_INVALID_ARG_TYPE` so consumers see
`code: 'ERR_INVALID_ARG_TYPE'` and the standard message
`The "options" argument must be of type object. Received type string ('not an object')`.

Enables `parallel/test-tls-no-cert-required.js`.
@bartlomieju bartlomieju merged commit b7a3fff into denoland:main Apr 27, 2026
112 checks passed
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.

3 participants