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

Fix bug where nested "bytes" property fails with TypeError #9

Merged
merged 1 commit into from
Aug 26, 2022
Merged

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 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
1 participant