Skip to content

Conversation

@ejizba
Copy link
Contributor

@ejizba ejizba commented Aug 24, 2022

If you try to send an http body with a nested "bytes" property that is a number it currently fails to execute.
Example request:

curl -X POST http://localhost:7071/api/helloWorld -d '{ "a": { "b": { "bytes": 4 }}}'

Error:

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (4)

The root of the problem is a combination of our fromTypedData and convertKeysToCamelCase methods. I think both have some fundamental issues, but I'm wary of refactoring because it might break people relying on the existing behavior. For now, I think it's good enough for us to catch any error and use the original value. I will save bigger refactors for the new programming model.

Fixes Azure/azure-functions-nodejs-worker#607

@ejizba ejizba requested a review from hossam-nasr August 24, 2022 21:28
@ejizba ejizba merged commit f193568 into v3.x Aug 26, 2022
@ejizba ejizba deleted the ej/bytes branch August 26, 2022 01:10
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

Successfully merging this pull request may close these issues.

Major bug in HttpTrigger receival of payload

2 participants