The Wayback Machine - https://web.archive.org/web/20200828091458/https://github.com/slackapi/node-slack-sdk/issues/906
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

Emit debug log when request verification fails due to being pre-parsed #906

Open
aoberoi opened this issue Nov 15, 2019 · 0 comments
Open

Emit debug log when request verification fails due to being pre-parsed #906

aoberoi opened this issue Nov 15, 2019 · 0 comments

Comments

@aoberoi
Copy link
Member

@aoberoi aoberoi commented Nov 15, 2019

Description

If an incoming request has already been parsed (such as by using the body-parser middleware), and there's no rawBody present (which commonly occurs on serverless platforms), then adapter will respond with a 500 status. In these situations, the debug logging should emit information that allows the developer to see the reason. It currently does not.

The @slack/events-api package has solved for this problem already:

// If parser is being used and we don't receive the raw payload via `rawBody`,
// we can't verify request signature
if (!isFalsy(req.body) && isFalsy(req.rawBody)) {
handleError(
errorWithCode(
new Error('Parsing request body prohibits request signature verification'),
ErrorCode.BodyParserNotPermitted,
),
respond,
);
return;
}

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.