Skip to content

fix: avoid node:domain emit crash on connection close#352

Open
SAY-5 wants to merge 1 commit into
eleith:mainfrom
SAY-5:fix-domain-emit-clash
Open

fix: avoid node:domain emit crash on connection close#352
SAY-5 wants to merge 1 commit into
eleith:mainfrom
SAY-5:fix-domain-emit-clash

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 27, 2026

Copy link
Copy Markdown

fixes #351

SMTPConnection extends EventEmitter but keeps a string domain field. Once anything loads the deprecated node:domain module (e.g. node:repl on node 24, or an explicit import on node 26), EventEmitter.usingDomains flips on and emit() starts calling this.domain.enter(). Because our domain is a string, that throws TypeError: domain.enter is not a function, which surfaces on connection.close() after sendAsync.

This renames the internal field to _domain so it no longer shadows the property the domain module manages. The public domain constructor option is unchanged. Added a regression test that loads node:domain and emits an event on a connection.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.

version 5.0.1+ - domain.enter() is not a function on connection close

1 participant