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

Beta Runtime's Request Body is a Buffer instead of Object #2875

Closed
danfsd opened this issue May 21, 2018 · 1 comment
Closed

Beta Runtime's Request Body is a Buffer instead of Object #2875

danfsd opened this issue May 21, 2018 · 1 comment

Comments

@danfsd
Copy link

danfsd commented May 21, 2018

Request's body is a <Buffer> instead of object in Azure Function's Runtime Beta. This works fine in the Cloud (which I suppose is running Runtime 1.x

Repro steps

Try to run the boilerplate Javascript code in the Runtime beta:

module.exports = function (context, req) {
    context.log('JavaScript HTTP trigger function processed a request.');
    context.log(context.req.body.name);
    if (req.query.name || (req.body && req.body.name)) {
        context.res = {
            // status: 200, /* Defaults to 200 */
            body: "Hello " + (req.query.name || req.body.name)
        };
    }
    else {
        context.res = {
            status: 400,
            body: "Please pass a name on the query string or in the request body"
        };
    }
    context.done();
};

Expected behavior

The context.log(context.req.body.name) should log:

2018-05-21T17:41:12.509 [Info] daniel

Actual behavior

Instead, it's logging:

<Buffer 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 33 30 38 32 35 30 31 33 36 35 39 30 36 31 38 38 37 30 38 32 36 32 ... >

Known workarounds

This scenario works just fine under the Runtime 1.x running on Azure Functions.

@pragnagopa
Copy link
Member

This issue was moved to Azure/azure-functions-nodejs-worker#76

@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants