Is there a way to return JSON on ALB lambda?How to access HTTP headers for request to AWS API Gateway using Lambda?API Gateway - Lambda proxy integration and asynchronous callAWS API Gateway Malformed Lambda ResponsePython lambda function returns KeyErrorReturning binary body and http headers from an AWS lambda through API gatewayReturning html from lambda function using expressAmazon Lambda - return docx file - Node.jsServe Binary responses via ALB and Lambda IntegrationI get an ALB Lambda error - 502 Bad GatewayReturning HTML response without API gateway in AWS Lambda for Node template

Will users know a CardView is clickable

Is pointing finger in meeting consider bad?

Am I being scammed by a sugar daddy?

What publication claimed that Michael Jackson died in a nuclear holocaust?

Does "aurea" have the second meaning?

ISP is not hashing the password I log in with online. Should I take any action?

How can religions without a hell discourage evil-doing?

How effective would a full set of plate armor be against wild animals found in temperate regions (bears, snakes, wolves)?

How Many Times To Repeat An Event With Known Probability Before It Has Occurred A Number of Times

usage of mir gefallen

A flower's head or heart?

Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?

I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?

Background for black and white chart

I received a gift from my sister who just got back from

Boss making me feel guilty for leaving the company at the end of my internship

What game uses dice with compass point arrows, forbidden signs, explosions, arrows and targeting reticles?

Would a bit of grease on overhead door cables or bearings cause the springs to break?

Jam with honey & without pectin has a saucy consistency always

How can I detect if I'm in a subshell?

Does WiFi affect the quality of images downloaded from the internet?

Short story about psychologist analyzing demon

Should I worry about having my credit pulled multiple times while car shopping?

Harley Davidson clattering noise from engine, backfire and failure to start



Is there a way to return JSON on ALB lambda?


How to access HTTP headers for request to AWS API Gateway using Lambda?API Gateway - Lambda proxy integration and asynchronous callAWS API Gateway Malformed Lambda ResponsePython lambda function returns KeyErrorReturning binary body and http headers from an AWS lambda through API gatewayReturning html from lambda function using expressAmazon Lambda - return docx file - Node.jsServe Binary responses via ALB and Lambda IntegrationI get an ALB Lambda error - 502 Bad GatewayReturning HTML response without API gateway in AWS Lambda for Node template






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have created lambda function on node.js which returns JSON.



It connected with API Gateway and worked well.



I want to connect it to amazon load balancer.



I tried it but it returns HTML page.



async function run(event)


let ret = ;

ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'


ret.code = 200;
return ret;


exports.handler = run;


How to return JSON?










share|improve this question






















  • How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?

    – Chetan Ranpariya
    Mar 25 at 1:42











  • It returns blank page. I didn't use 'JSON.stringify' for JSON

    – USER
    Mar 25 at 3:06


















0















I have created lambda function on node.js which returns JSON.



It connected with API Gateway and worked well.



I want to connect it to amazon load balancer.



I tried it but it returns HTML page.



async function run(event)


let ret = ;

ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'


ret.code = 200;
return ret;


exports.handler = run;


How to return JSON?










share|improve this question






















  • How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?

    – Chetan Ranpariya
    Mar 25 at 1:42











  • It returns blank page. I didn't use 'JSON.stringify' for JSON

    – USER
    Mar 25 at 3:06














0












0








0








I have created lambda function on node.js which returns JSON.



It connected with API Gateway and worked well.



I want to connect it to amazon load balancer.



I tried it but it returns HTML page.



async function run(event)


let ret = ;

ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'


ret.code = 200;
return ret;


exports.handler = run;


How to return JSON?










share|improve this question














I have created lambda function on node.js which returns JSON.



It connected with API Gateway and worked well.



I want to connect it to amazon load balancer.



I tried it but it returns HTML page.



async function run(event)


let ret = ;

ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'


ret.code = 200;
return ret;


exports.handler = run;


How to return JSON?







aws-lambda aws-load-balancer






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 1:30









USERUSER

126212




126212












  • How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?

    – Chetan Ranpariya
    Mar 25 at 1:42











  • It returns blank page. I didn't use 'JSON.stringify' for JSON

    – USER
    Mar 25 at 3:06


















  • How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?

    – Chetan Ranpariya
    Mar 25 at 1:42











  • It returns blank page. I didn't use 'JSON.stringify' for JSON

    – USER
    Mar 25 at 3:06

















How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?

– Chetan Ranpariya
Mar 25 at 1:42





How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?

– Chetan Ranpariya
Mar 25 at 1:42













It returns blank page. I didn't use 'JSON.stringify' for JSON

– USER
Mar 25 at 3:06






It returns blank page. I didn't use 'JSON.stringify' for JSON

– USER
Mar 25 at 3:06













1 Answer
1






active

oldest

votes


















2














Add a stringified body attribute to the response



async function run(event)


let ret = ;

ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
,
'body': JSON.stringify(
test: 1
)

ret.code = 200;
return ret;


exports.handler = run;





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330260%2fis-there-a-way-to-return-json-on-alb-lambda%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Add a stringified body attribute to the response



    async function run(event)


    let ret = ;

    ret =
    'statusCode': 200,
    'statusDescription': '200 OK',
    'headers':
    'Content-Type': 'application/json'
    ,
    'body': JSON.stringify(
    test: 1
    )

    ret.code = 200;
    return ret;


    exports.handler = run;





    share|improve this answer





























      2














      Add a stringified body attribute to the response



      async function run(event)


      let ret = ;

      ret =
      'statusCode': 200,
      'statusDescription': '200 OK',
      'headers':
      'Content-Type': 'application/json'
      ,
      'body': JSON.stringify(
      test: 1
      )

      ret.code = 200;
      return ret;


      exports.handler = run;





      share|improve this answer



























        2












        2








        2







        Add a stringified body attribute to the response



        async function run(event)


        let ret = ;

        ret =
        'statusCode': 200,
        'statusDescription': '200 OK',
        'headers':
        'Content-Type': 'application/json'
        ,
        'body': JSON.stringify(
        test: 1
        )

        ret.code = 200;
        return ret;


        exports.handler = run;





        share|improve this answer















        Add a stringified body attribute to the response



        async function run(event)


        let ret = ;

        ret =
        'statusCode': 200,
        'statusDescription': '200 OK',
        'headers':
        'Content-Type': 'application/json'
        ,
        'body': JSON.stringify(
        test: 1
        )

        ret.code = 200;
        return ret;


        exports.handler = run;






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 25 at 8:24









        Thales Minussi

        2,1771723




        2,1771723










        answered Mar 25 at 1:52









        Dawid K.Dawid K.

        1327




        1327





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330260%2fis-there-a-way-to-return-json-on-alb-lambda%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현