URGENT | Breaking Change | Cannot set property errored of #<Readable> which has only a getter
Closed this issue · 7 comments
Hello Community,
Please note that there is a breaking change when using this package with Node.js 18+. In short, it works as expected with Node.js 16.7.x, however, will throw an uncaught error message: 'Cannot set property errored of # which has only a getter' on Node.js 18+.
I traced this error to node_modules/mailsplit/lib/message-splitter.js line 24. In short, the mailsplit package is required by mailparse, in which mailparse is required by node-mailin. It seems mailparse has not been updated in 5 years.
Can you take a look into this issue? Notice to anyone using 18+, it will simply not work any longer. You'll need to downgrade.
Thanks!
@palmtown there is a fork with updated dependencies (to get rid of known vulnerabilities). Mailsplit is updated there as well.
Hello @nordluf,
Thanks for your response. Do you know which fork specifically? I am going through the forks now to understand which one solves the referenced issue, however, thought you might know one that has been tested and confirmed working.
Thanks.
Hello @nordluf,
Actually, it may be your fork at https://github.com/nordluf/node-mailin :) - Seems mailparserhas been bumped to 3.0.0. I'll give this one a try.
@palmtown Since I am not the only one who wants to use this updated version, I have published an npmjs version: https://www.npmjs.com/package/@umpacken/node-mailin
If you want to do a seamless update, you can use an npm alias in your package.json like this:
- "node-mailin": "^2.5.0",
+ "node-mailin": "npm:@umpacken/node-mailin@^2.6.1",
Hello @nordluf,
Please note that this fix works. Thank you so much for your time in helping to resolve this issue, much appreciated!
Hey, I have the same issue every time I receive an email. I've tried Node 17, 18, or 20 and node-mailin
2.5.0, 2.6.1, 2.7.0.
info: NodeMailin Smtp server listening on port 25
/mail/node_modules/smtp-server/lib/smtp-stream.js:34
this.closed = false;
^
TypeError: Cannot set property closed of #<Writable> which has only a getter
at new SMTPStream (/mail/node_modules/smtp-server/lib/smtp-stream.js:34:13)
at new SMTPConnection (/mail/node_modules/smtp-server/lib/smtp-connection.js:55:24)
at SMTPServer.connect (/mail/node_modules/smtp-server/lib/smtp-server.js:93:26)
at /mail/node_modules/smtp-server/lib/smtp-server.js:84:26
at Immediate.<anonymous> (/mail/node_modules/smtp-server/lib/smtp-server.js:345:39)
at process.processImmediate (node:internal/timers:476:21)