Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Fix TypeError when rawBody returns err#71

Merged
yaronschwimmer merged 3 commits into
HumanSecurity:devfrom
dalgleish:fix-TypeError-undefined
Dec 11, 2018
Merged

Fix TypeError when rawBody returns err#71
yaronschwimmer merged 3 commits into
HumanSecurity:devfrom
dalgleish:fix-TypeError-undefined

Conversation

@dalgleish

Copy link
Copy Markdown
Contributor

When raw-body returns an err, the callback will be called with an undefined string parameter.
This change logs some detail about the errpr provided by raw-body and rejects the promise.

When `raw-body` returns an `err`, the callback will be called with an undefined `string` parameter.
This change logs some detail about the errpr provided by [raw-body](https://github.com/stream-utils/raw-body#errors) and rejects the promise.
@dalgleish

dalgleish commented Dec 10, 2018

Copy link
Copy Markdown
Contributor Author

Sorry, test are not passing.
I'll follow the contribution guidelines and maybe I can add a test for this case.

BTW, we get this in production. We're using perimeterx-node-express@3.4.0:

TypeError: Cannot read property 'toString' of undefined
    at /app/node_modules/perimeterx-node-core/lib/pxproxy.js:240:42
    at invokeCallback (/app/node_modules/raw-body/index.js:224:16)
    at done (/app/node_modules/raw-body/index.js:213:7)
    at IncomingMessage.onAborted 

@yaronschwimmer

Copy link
Copy Markdown

Hi @dalgleish
Thank you for your contribution. We'll review it and merge if everything looks right.

@yaronschwimmer yaronschwimmer changed the base branch from master to dev December 11, 2018 09:37
@yaronschwimmer yaronschwimmer merged commit 08cb53b into HumanSecurity:dev Dec 11, 2018
@dalgleish dalgleish deleted the fix-TypeError-undefined branch December 11, 2018 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants