haraka / Haraka

A fast, highly extensible, and event driven SMTP server

Home Page:https://haraka.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[core] TypeError: Cannot read properties of undefined (reading 'name')

analogic opened this issue · comments

[CRIT] [-] [core] TypeError: Cannot read properties of undefined (reading 'name')
[CRIT] [-] [core]     at ResultStore._log (/usr/lib/node_modules/Haraka/node_modules/haraka-results/index.js:226:25)
[CRIT] [-] [core]     at ResultStore.add (/usr/lib/node_modules/Haraka/node_modules/haraka-results/index.js:101:17)
[CRIT] [-] [core]     at mxErr (/usr/lib/node_modules/Haraka/plugins/mail_from.is_resolvable.js:73:17)
[NOTICE] [-] [core] Shutting down

I came across this bug in a random test.

results.add(this, {err: `${domain}:${err.message}`});

It seems that this is used in the wrong context when catching an exception.

Indeed. Two ways to solve that:

1

-        results.add(this, {err: `${domain}:${err.message}`});
+        results.add(plugin, {err: `${domain}:${err.message}`});

2

-    function mxErr (err) {
+    const mxErr = (err) => {