Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser constructor error #670

Closed
jasan-s opened this issue Mar 21, 2018 · 1 comment · Fixed by #812
Closed

parser constructor error #670

jasan-s opened this issue Mar 21, 2018 · 1 comment · Fixed by #812
Labels
difficulty: unknown or n/a fix is unknown in difficulty status: help wanted requesting help from the community type: bug bug in the library

Comments

@jasan-s
Copy link

jasan-s commented Mar 21, 2018

Issue Summary

I am getting the following error when using inbound-parse feature from sendgrid:

uncaught, handler, error TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at Parse.keyValues (/Users/jasan/Documents/coding/sendgrid-parse-api-example/node_modules/@sendgrid/inbound-mail-parser/src/parser.js:54:8)

I believe it is due to the constructor in this parser.js:

 constructor(config, request) {
    this.keys = config.keys;
    this.request = request;
    this.payload = request.body || {};
    this.files = request.files || [];
  }

after changing the line:
this.payload = request.body || {} to ==> this.payload = request.payload || {}

it seems to work fine.

Technical details:

using the "@sendgrid/inbound-mail-parser": "^6.2.1"

@thinkingserious thinkingserious added type: bug bug in the library status: help wanted requesting help from the community up-for-grabs difficulty: unknown or n/a fix is unknown in difficulty labels Mar 22, 2018
@thinkingserious
Copy link
Contributor

Hi @jasan-s,

Thanks for the heads up @jasan-s! I've added this to our backlog for a fix.

With Best Regards,

Elmer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: unknown or n/a fix is unknown in difficulty status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants