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

TypeError - Cannot read properties of undefined (reading 'includes') in lib/isEligibleRequest.js #364

Closed
dimitri-gigot opened this issue Nov 13, 2023 · 4 comments

Comments

@dimitri-gigot
Copy link

Hi,

Since version 1.4.2 , this error appeared in our Sentry.
Seems easy to fix by checking if "contType" exist before trying to see if it "includes('boundary=')".

I'm not used to posting issues or trying to fix them but i'll do my best 😄

@king-d-dev
Copy link

+1

@king-d-dev
Copy link

here's a PR that addresses the bug
#366
cc @richardgirges

@RomanBurunkov
Copy link
Collaborator

RomanBurunkov commented Nov 21, 2023

Hi,

I have another idea regarding this.
Since it can be several cases which lead to the exception, what if just wrap the final function in try/catch,
instead of trying to consider all possible options?

module.exports = (req) => {
  try {
    return hasBody(req) && hasAcceptableMethod(req) && hasAcceptableContentType(req);
  } catch (e) {
    return false;
  }
};

@RomanBurunkov
Copy link
Collaborator

Fixed with the PR #367
Published new version 1.4.3

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

No branches or pull requests

3 participants