umanamente / n8n-nodes-imap

This is an n8n community node that adds support for IMAP email servers.
MIT License
10 stars 1 forks source link

Cannot read properties of undefined (reading 'on') #19

Closed vialcollet closed 4 days ago

vialcollet commented 1 month ago

I have an email in my mailbox which triggers the error below.
When I move this email in another folder, the workflow runs smoothly again.
What type of information would you need on this email? It's not a legit email...

{
  "errorMessage": "Cannot read properties of undefined (reading 'on')",
  "errorDetails": {},
  "n8nDetails": {
    "nodeName": "IMAP1",
    "nodeType": "n8n-nodes-imap.imap",
    "nodeVersion": 1,
    "resource": "email",
    "operation": "getEmailsList",
    "time": "27/05/2024 17:00:47",
    "n8nVersion": "1.42.1 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeApiError: Cannot read properties of undefined (reading 'on')",
      "    at Object.execute (/home/node/.n8n/nodes/node_modules/n8n-nodes-imap/nodes/Imap/Imap.node.ts:189:19)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:664:53",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1073:20"
    ]
  }
}

Here is the source:

ARC-Seal: i=1; cv=none; a=rsa-sha256; d=mydomain.fr; s=default;
 t=1716428404;
 b=grfzw7/q/wZCe7LV3Gh271DMW16HR72KPTY7K+i7ptUzgGDfg9xP3ktSqEthdIGSUdiPv
 peHbfRViprFh0GZymg0DXRPP7grVKIxHti3pLPAbIyGwlQUgiNO0vtT98gHtnZBtndIQa5Q
 oivEz3KTjTU3FMiOm9h/XM37I94r3jI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mydomain.fr;
 s=default; t=1716428404; h=message-id : from : to : subject : date :
 mime-version : content-type : from;
 bh=nU6J6qwtbdp3GEukNan4crzmdXo60WgSrSCBE3L57DY=;
 b=IfDnm1gWH/GObIY4A2yIGr1VnOaShLcQZG6oLUYAzOjJpIDu7dVyebu1/V7vpUtOgc0af
 4kuRLNhox+kkfRYtKjyJE5SszsA6UjhT4761qKhcxCATF2emLALgwagIv17b872Qd3TUUgh
 ChkM9+AI2VcTtz5QBbyarAqoV+624xQ=
ARC-Authentication-Results: i=1; sub.mydomain.fr;
  dmarc=none smtp.from=j.pilgrimshelter.com header.from=j.pilgrimshelter.com;
  spf=none smtp.mailfrom=john.doe@j.pilgrimshelter.com smtp.helo=j.pilgrimshelter.com
Return-Path: <john.doe@j.pilgrimshelter.com>
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on sub.mydomain.fr
X-Spam-Level: ***
X-Spam-Status: No, score=4.0 required=7.0 tests=BAYES_05,DKIM_ADSP_NXDOMAIN,
    HTML_FONT_TINY_NORDNS,HTML_MESSAGE,MIME_HTML_MOSTLY,MPART_ALT_DIFF,
    NO_DNS_FOR_FROM,NUMERIC_HTTP_ADDR,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_BL,
    RCVD_IN_MSPIKE_L5,RCVD_IN_PSBL,RCVD_IN_VALIDITY_RPBL,
    RCVD_IN_ZEN_BLOCKED_OPENDNS,RDNS_NONE,SPF_HELO_NONE,SPF_NONE,
    T_KAM_HTML_FONT_INVALID,URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS,
    URIBL_ZEN_BLOCKED_OPENDNS,XPRIO autolearn=no autolearn_force=no
    version=3.4.4
X-Original-To: john.doe@mydomain.fr
Delivered-To: john.doe@mydomain.fr
Received: from j.pilgrimshelter.com (unknown [5.180.183.170])
    by sub.mydomain.fr (Postfix) with ESMTPS id 201C66A02E4
    for <john.doe@mydomain.fr>; Thu, 23 May 2024 01:39:58 +0000 (UTC)
Authentication-Results: sub.mydomain.fr;
    dmarc=none (p=NONE sp=NONE) smtp.from=j.pilgrimshelter.com header.from=j.pilgrimshelter.com;
    spf=none (sender IP is 5.180.183.170) smtp.mailfrom=john.doe@j.pilgrimshelter.com smtp.helo=j.pilgrimshelter.com
Received-SPF: none (sub.mydomain.fr: no valid SPF record)
Message-ID: <dbwgucrgcamoospipzdyrabgaukboz7slvbmjm2xjxttwhvxxbc.eo6btgpcwit9fqjhcev9.awan4emocp.g2dj3xsfbh.znxtacmez5@j.pilgrimshelter.com>
From: Rolex <john.doe@j.pilgrimshelter.com>
To: john.doe <john.doe@mydomain.fr>
Subject: Discount Designer Watches at Only $250 - Shop Now!
Date: Thu, 23 May 2024 03:39:47 +0100
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="==-==2xzckmckbc2aiadurdxb7lkqxqiflfolvmu0ah0l9ywbe4xhkqcctx0chntnngmnxxlmc38fz90oqam1ov0nrqg9xhybfrut7dw==-=="
X-Priority: 3
X-Antivirus: AVG (VPS 240527-2, 27/5/2024), Inbound message
X-Antivirus-Status: Clean

This is a multi-part message in MIME format.

--==-==2xzckmckbc2aiadurdxb7lkqxqiflfolvmu0ah0l9ywbe4xhkqcctx0chntnngmnxxlmc38fz90oqam1ov0nrqg9xhybfrut7dw==-==
Content-Type: text/plain;
    charset="windows-1255"
Content-Transfer-Encoding: 8bit

sd5f4s3dfg45w6erf
--==-==2xzckmckbc2aiadurdxb7lkqxqiflfolvmu0ah0l9ywbe4xhkqcctx0chntnngmnxxlmc38fz90oqam1ov0nrqg9xhybfrut7dw==-==
Content-Type: text/html;
    charset="windows-1255"
Content-Transfer-Encoding: 8bit

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office">
<head><title></title>
<meta content="text/html; charset=windows-1255" http-equiv=Content-Type>
<meta name=x-apple-disable-message-reformatting>
<meta name=viewport content="width=device-width, initial-scale=1.0">
<style type=text/css>
    body, .maintable { height:100% !important; width:100% !important; margin:0; padding:0;}
    img, a img { border:0; outline:none; text-decoration:none;}
    p {margin-top:0; margin-right:0; margin-left:0; padding:0;}
    .ReadMsgBody {width:100%;}
    .ExternalClass {width:100%;}
    .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height:100%;}
    img {-ms-interpolation-mode: bicubic;}
    body, table, td, p, a, li, blockquote {-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%;}
</style>

<style type=text/css>
@media only screen and (max-width: 480px) {
 .rtable {width: 100% !important;}
 .rtable tr {height:auto !important; display: block;}
 .contenttd {max-width: 100% !important; display: block; width: auto !important;}
 .contenttd:after {content: ""; display: table; clear: both;}
 .hiddentds {display: none;}
 .imgtable, .imgtable table {max-width: 100% !important; height: auto; float: none; margin: 0 auto;}
 .imgtable.btnset td {display: inline-block;}
 .imgtable img {width: 100%; height: auto !important;display: block;}
 table {float: none;}
 .mobileHide {display: none !important; width: 0 !important; max-height: 0 !important; overflow: hidden !important;}
 .desktopHide {display: block !important; width: 100% !important; max-height: unset !important; overflow: unset !important;}
 .noresponsive p {display: table; table-layout: fixed; width: 100%; word-wrap: break-word;}
}
@media only screen and (min-width: 481px) {
 .desktopHide {display: none !important; width: 0 !important; max-height: 0 !important; overflow: hidden !important;}
}
</style>

</head>
<body style="overflow:auto;cursor:auto;font-size:14px;font-family:HoloLens MDL2 Assets;padding-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;background-color:#feffff;">
<table style="background-color:#feffff;" cellSpacing=0 cellPadding=0 width="100%">
  <tbody>
  <tr>
    <td style="font-size:0px;height:0px;line-height:0;"></td></tr>
  <tr>
    <td vAlign=top>
      <table class=rtable style="width:960px;margin:0px auto;" cellSpacing=0 cellPadding=0 width=960 align=center border=0>
        <tbody>
        <tr>
          <th class=contenttd style="border-top:medium none;border-right:medium none;width:960px;border-bottom:medium none;font-weight:normal;padding-bottom:0px;text-align:left;padding-top:0px;padding-left:0px;border-left:medium none;padding-right:0px;background-color:#feffff;">
            <table style="width:100%;" cellSpacing=0 cellPadding=0 align=left>
              <tbody>
              <tr style="height:2221px;" height=2221>
                <th class=contenttd style="border-top:medium none;border-right:medium none;width:950px;vertical-align:top;border-bottom:medium none;font-weight:normal;padding-bottom:5px;text-align:left;padding-top:5px;padding-left:5px;border-left:medium none;padding-right:5px;background-color:transparent;">
                  <p style="margin-bottom:1em;font-size:14px;font-family:HoloLens MDL2 Assets;color:#2d2d2d;text-align:center;margin-top:0px;line-height:18px;background-color:transparent;mso-line-height-rule:exactly;" align=center>If you can't read this email, please <a title="" style="text-decoration:underline;color:#2d2d2d;" href="https://ll.pzgqziegnm.ru/5ghj49r5165df46swer2w/df5g6sf54v2ew34rdsf3qw6r.html" target=_blank>view it online</a></p>
                  <table class=imgtable style="margin:0px auto;" cellSpacing=0 cellPadding=0 align=center border=0>
                    <tbody>
                    <tr>
                      <td style="padding-bottom:0px;padding-top:0px;padding-left:0px;padding-right:0px;" align=center>
                        <table cellSpacing=0 cellPadding=0 border=0>
                          <tbody>
                          <tr>
                            <td style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;"><a href="https://ll.pzgqziegnm.ru/5ghj49r5165df46swer2w/df5g6sf54v2ew34rdsf3qw6r.html" target=_blank><img style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;display:block;" hspace=0 alt="Unbelievable Price Crash: Discount Designer Watches Starting at $250 - Shop Today!" src="./62_files/125etndcdnxde1qdg4gdpjis009.jpg" width=950></a></td></tr></tbody></table></td></tr></tbody></table>
                  <table class=imgtable style="margin:0px auto;" cellSpacing=0 cellPadding=0 align=center border=0>
                    <tbody>
                    <tr>
                      <td style="padding-bottom:0px;padding-top:0px;padding-left:0px;padding-right:0px;" align=center>
                        <table cellSpacing=0 cellPadding=0 border=0>
                          <tbody>
                          <tr>
                            <td style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;"><a href="https://ll.pzgqziegnm.ru/5ghj49r5165df46swer2w/df5g6sf54v2ew34rdsf3qw6r.html" target=_blank><img style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;display:block;" hspace=0 alt="Unbelievable Price Crash: Discount Designer Watches Starting at $250 - Shop Today!" src="./62_files/fw0jl5mh7s481bnltijqi2onzqhw707cvqjj61ketsl2cw.jpg" width=950></a></td></tr></tbody></table></td></tr></tbody></table>
                  <table class=imgtable style="margin:0px auto;" cellSpacing=0 cellPadding=0 align=center border=0>
                    <tbody>
                    <tr>
                      <td style="padding-bottom:0px;padding-top:0px;padding-left:0px;padding-right:0px;" align=center>
                        <table cellSpacing=0 cellPadding=0 border=0>
                          <tbody>
                          <tr>
                            <td style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;"><a href="https://ll.pzgqziegnm.ru/5ghj49r5165df46swer2w/df5g6sf54v2ew34rdsf3qw6r.html" target=_blank><img style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;display:block;" hspace=0 alt="Affordable Luxury: Discount Designer Watches for Just $250 - Shop Now!" src="./62_files/4qycm5smvj5rivmuym0o33ijtyt5omqsmfvv830yws.jpg" width=950></a></td></tr></tbody></table></td></tr></tbody></table><!-- "(3) A good deal of what you have thought is, I fancy, based on a strange -->
                  <table class=imgtable style="margin:0px auto;" cellSpacing=0 cellPadding=0 align=center border=0><!-- tears with veils finer than those of the almehs!' -->
                    <tbody>
                    <tr><!-- victories for which he longs, but which singularly avoid him as a man -->
                      <td style="padding-bottom:0px;padding-top:0px;padding-left:0px;padding-right:0px;" align=center>
                        <table cellSpacing=0 cellPadding=0 border=0><!-- humiliating and threatening to them than the view that the falling of a -->
                          <tbody>
                          <tr>
                            <td style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;"><a href="https://ll.pzgqziegnm.ru/5ghj49r5165df46swer2w/df5g6sf54v2ew34rdsf3qw6r.html" target=_blank><img style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;display:block;" hspace=0 alt="Amazing Discount Bonanza: Discount Designer Watches Starting at $250 - Shop Today!" src="./62_files/d6a4t.jpg" width=949></a></td><!-- He lit a match and looked at his watch. "In twenty minutes," --></tr><!-- EVE [_pointing to the fawn_] Like that. I call it dead. --></tbody></table></td></tr><!-- opportunities for thorough acquaintance with Spanish-American --></tbody></table><!-- Edna wondered if they had all gone mad, to be talking and -->
                  <table class=imgtable style="margin:0px auto;" cellSpacing=0 cellPadding=0 align=center border=0><!-- As for the queen and mistress of so much neatness and comfort, I must -->
                    <tbody>
                    <tr>
                      <td style="padding-bottom:0px;padding-top:0px;padding-left:0px;padding-right:0px;" align=center>
                        <table cellSpacing=0 cellPadding=0 border=0><!-- incapable. Accordingly, you imported educated negresses and Chinese to -->
                          <tbody>
                          <tr>
                            <td style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;"><a href="https://ll.pzgqziegnm.ru/5ghj49r5165df46swer2w/df5g6sf54v2ew34rdsf3qw6r.html" target=_blank><img style="border-top:medium none;border-right:medium none;border-bottom:medium none;border-left:medium none;display:block;" hspace=0 alt="Unbelievable Price Crash: Discount Designer Watches Starting at $250 - Shop Today!" src="./62_files/mxk4qxyakac6593x5e03mcue05b.jpg" width=950></a></td><!-- passion is betrayed into an act of infidelity, and realizes the --></tr><!-- peculiarly Beethoven-like abuses of punctuation, orthography, and --></tbody></table></td><!-- rich enough by the time he had reached middle life, threw down his --></tr></tbody></table><!-- looked to me like a tangible foundation to begin upon. -->
                  <p style="margin-bottom:1em;font-size:14px;font-family:HoloLens MDL2 Assets;color:#2d2d2d;text-align:center;margin-top:0px;line-height:18px;background-color:transparent;mso-line-height-rule:exactly;" align=center><br>To unsubscribe, <a title="" style="color:#2d2d2d;" href="https://ll.pzgqziegnm.ru/return.php?p=TUsxP2Jhc3RpZW4udmlhbC1jb2xsZXRAY3VydWJhLmZyPzUyOTI2P2Jhc3RpZW4udmlhbC1jb2xsZXRAai5waWxncmltc2hlbHRlci5jb20%3D" target=_blank>click here</a>.</p><!-- greater things." Another instance is afforded in the grand intuition of --></th><!-- as drawn up by a Committee chosen by the said Pastors, read and --></tr></tbody></table><!-- Walker, and led us to a house in the outer parts of the town, where, he --></th><!-- always in their presence. After a vain appeal that some sort of --></tr><!-- Mademoiselle Reisz if she considered the symphony concerts up to --></tbody></table></td><!-- But meanwhile--and here comes the horror of it--our technical --></tr>
  <tr>
    <td style="font-size:0px;height:8px;line-height:0;">&nbsp;</td><!-- Theseus, old Nestor, Agamemnon, bearing a sceptre and with a fillet on --></tr></tbody></table><!-- raged at the thought of his lamps' smoking, and tongued a few anathemas --><!-- the dewy path. She took his arm, but she did not lean upon it. -->
</body>
</html>

--==-==2xzckmckbc2aiadurdxb7lkqxqiflfolvmu0ah0l9ywbe4xhkqcctx0chntnngmnxxlmc38fz90oqam1ov0nrqg9xhybfrut7dw==-==--
umanamente commented 1 month ago

Please remove Text Content and HTML Content and add Body Structure. If this works please send the JSON with bodyStructure

vialcollet commented 1 month ago

Sorry... I had deleted the email :( I received a new one. Removing text and html content it is working. Here is the JSON with Body Structure.

[
  {
    "seq": 23461,
    "uid": 93668,
    "modseq": "120126",
    "bodyStructure": {
      "childNodes": [
        {
          "part": "1",
          "type": "text/plain",
          "parameters": {
            "charset": "windows-1255"
          },
          "encoding": "8bit",
          "size": 14,
          "lineCount": 0
        },
        {
          "part": "2",
          "type": "text/html",
          "parameters": {
            "charset": "windows-1255"
          },
          "encoding": "8bit",
          "size": 12408,
          "lineCount": 98
        }
      ],
      "type": "multipart/alternative",
      "parameters": {
        "boundary": "____=__--====3zjxwteaesygd7orzsy5xebtaxbxcghbmjnpqoltby====--__=____"
      }
    },
    "envelope": {
      "date": "2024-06-03T17:17:01.000Z",
      "subject": "Redefine Your Style with LV Bags: Unbelievable Discount - Only $150!",
      "from": [
        {
          "name": "Louis Vuitton",
          "address": "first.lastnameoversea@t.tatildekibris.com"
        }
      ],
      "sender": [
        {
          "name": "Louis Vuitton",
          "address": "first.lastnameoversea@t.tatildekibris.com"
        }
      ],
      "replyTo": [
        {
          "name": "Louis Vuitton",
          "address": "first.lastnameoversea@t.tatildekibris.com"
        }
      ],
      "to": [
        {
          "name": "first.lastname",
          "address": "first.lastname@mydomain.fr"
        }
      ],
      "messageId": "<46721.tcslecuwljeduzp.ntb.xdhmxilz.lzmehmq@t.tatildekibris.com>"
    },
    "id": "8cee855969c55dbea4804ea4cc5f1002"
  },
  {
    "seq": 23470,
    "uid": 93680,
    "modseq": "120142",
    "bodyStructure": {
      "childNodes": [
        {
          "part": "1",
          "type": "text/plain",
          "parameters": {
            "charset": "iso-2022-jp"
          },
          "encoding": "8bit",
          "size": 17,
          "lineCount": 1
        },
        {
          "part": "2",
          "type": "text/html",
          "parameters": {
            "charset": "iso-2022-jp"
          },
          "encoding": "8bit",
          "size": 11324,
          "lineCount": 99
        },
        {
          "part": "3",
          "type": "text/plain",
          "parameters": {
            "charset": "us-ascii"
          },
          "encoding": "7bit",
          "size": 0,
          "lineCount": 0
        }
      ],
      "type": "multipart/alternative",
      "parameters": {
        "boundary": "__-----------whdlx7uhmddlftv7iyavwi4frv12uigjd1smps8gl1hvfqcln0icbylhruurzydigiijw82u4zejiwuuvuxodfzzcbpxfsdstwvade8oe3ren0ajv59lu7gnwyqdmrpztr3qbk2actm1mohiyplhnaoun-----------__"
      }
    },
    "envelope": {
      "date": "2024-06-03T22:53:36.000Z",
      "subject": "Discount Designer Watches on Sale - Starting at $250!",
      "from": [
        {
          "name": "Rolex",
          "address": "first.lastnamexjqscl@z.professeurkone.com"
        }
      ],
      "sender": [
        {
          "name": "Rolex",
          "address": "first.lastnamexjqscl@z.professeurkone.com"
        }
      ],
      "replyTo": [
        {
          "name": "Rolex",
          "address": "first.lastnamexjqscl@z.professeurkone.com"
        }
      ],
      "to": [
        {
          "name": "first.lastname",
          "address": "first.lastname@mydomain.fr"
        }
      ],
      "messageId": "<t3o7g7cvqf4uofwt.ovn4akw27yo3lfcgssaib1-grrjp7dc36kz0zopncvv7f.wffndhijnrafc@z.professeurkone.com>"
    },
    "id": "ddb4ec53a27d2e44c88d65c50923ebbd"
  }
]

Please note that I replaced my name with first.lastname. Thanks in advance!

umanamente commented 1 month ago

"Cannot read properties of undefined (reading 'on')" is suppressed in 1.3.1. However retrieving text or HTML contents might not work for these emails. I couldn't find out what is wrong with them.