AWS Custom Lamba Authorizer called twice for single request from client with empty event object second timeAWS API Gateway Custom Authorizer AuthorizerConfigurationExceptionAWS API Gateway Custom Authorizer with Proxy setup - Add Custom Headers to RequestAWS API Gateway custom authorizer. How to access principalId in lambdaAWS API Gateway Security with a Custom Authoriser & AWS Service IntegrationsAccess POST Request body from Custom Authorizer Lambda FunctionPrincipal ID for unauthenticated / guest request, via Lambda custom authorizer?How to write policies for multiple custom authorizers in one API Gateway REST API?How to implement authorization in AWS api gateway using cognito user pools?AWS Custom Authorizer times outIn AWS Api gateway custom authorizer, how to add custom headers to the input request based on validation on headers and send to backend

How do draw effects during the discard phase work?

Why has Marx's "Das Kapital" been translated to "Capital" in English and not "The Capital"

How do I write a vertically-stacked definition of a sequence?

Draw the ☣ (Biohazard Symbol)

Fantasy Military Arms and Armor: the Dwarven Grand Armory

What's this inadvertent thing?

How do German speakers decide what should be on the left side of the verb?

How many attacks exactly do I get combining Dual Wielder feat with Two-Weapon Fighting style?

Why did Boris Johnson call for new elections?

Let A,B,C be sets. If A△B=A△C, does this imply that B=C?

Why are some hotels asking you to book through Booking.com instead of matching the price at the front desk?

Is future tense in English really a myth?

The Green Glass Door, Revisited

Can taking my 1-week-old on a 6-7 hours journey in the car lead to medical complications?

Was Rosie the Riveter sourced from a Michelangelo painting?

When does order matter in probability?

Why do we buy the Mazur Swindle in knot theory?

Project Euler problem #112

Does the word voltage exist in academic engineering?

More than three domains hosted on the same IP address

What makes an ending "happy"?

Should I tip on the Amtrak train?

If every star in the universe except the Sun were destroyed, would we die?

Dissuading my girlfriend from a scam



AWS Custom Lamba Authorizer called twice for single request from client with empty event object second time


AWS API Gateway Custom Authorizer AuthorizerConfigurationExceptionAWS API Gateway Custom Authorizer with Proxy setup - Add Custom Headers to RequestAWS API Gateway custom authorizer. How to access principalId in lambdaAWS API Gateway Security with a Custom Authoriser & AWS Service IntegrationsAccess POST Request body from Custom Authorizer Lambda FunctionPrincipal ID for unauthenticated / guest request, via Lambda custom authorizer?How to write policies for multiple custom authorizers in one API Gateway REST API?How to implement authorization in AWS api gateway using cognito user pools?AWS Custom Authorizer times outIn AWS Api gateway custom authorizer, how to add custom headers to the input request based on validation on headers and send to backend






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have configured a custom lambda authorizer of REQUEST type. I have added 4 new custom request headers as Identity source at API --> Authorizers --> Identity Sources and 1 default Authorization. So in total there are 5.



When I make a call to the API which has the above authorizer configured, the authorizer is being called twice. First time with values to all parameters in the event object second time with empty event object.



Since event object is null, my code is throwing null pointer even though first time validated claims successfully and returned Allow policy.



Initially I tried with token type authorizer but token alone itself was not enough for me to verify. Token type works just fine. I.e. there is no 2nd request made.
When I moved to REQUEST type I started seeing this issue.



Below are logs from cloudwatch



2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad DEBUG APIGatewayLambdaAuthorizer:92 - Sucess: Request authorized
2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad TRACE APIGatewayLambdaAuthorizer:103 - Exit: Policy generated: policyDocument=Version=2012-10-17, Statement=[Action=execute-api:Invoke, Resource=arn:aws:execute-api:us-east-2:851424344156:67w9c9wojb/stage/GET/, Effect=Allow], principalId=yC98Q4Edda9QqwYVkkhe75sUR8SS25pK@clients
2019-03-28 05:53:33 090465d8-2c04-4869-83fb-cdcde53d33b7 TRACE APIGatewayLambdaAuthorizer:82 - Enter event:

, context: lambdainternal.api.LambdaContext@4c5474f5
java.lang.NullPointerException: java.lang.NullPointerException
java.lang.NullPointerException









share|improve this question






























    0















    I have configured a custom lambda authorizer of REQUEST type. I have added 4 new custom request headers as Identity source at API --> Authorizers --> Identity Sources and 1 default Authorization. So in total there are 5.



    When I make a call to the API which has the above authorizer configured, the authorizer is being called twice. First time with values to all parameters in the event object second time with empty event object.



    Since event object is null, my code is throwing null pointer even though first time validated claims successfully and returned Allow policy.



    Initially I tried with token type authorizer but token alone itself was not enough for me to verify. Token type works just fine. I.e. there is no 2nd request made.
    When I moved to REQUEST type I started seeing this issue.



    Below are logs from cloudwatch



    2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad DEBUG APIGatewayLambdaAuthorizer:92 - Sucess: Request authorized
    2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad TRACE APIGatewayLambdaAuthorizer:103 - Exit: Policy generated: policyDocument=Version=2012-10-17, Statement=[Action=execute-api:Invoke, Resource=arn:aws:execute-api:us-east-2:851424344156:67w9c9wojb/stage/GET/, Effect=Allow], principalId=yC98Q4Edda9QqwYVkkhe75sUR8SS25pK@clients
    2019-03-28 05:53:33 090465d8-2c04-4869-83fb-cdcde53d33b7 TRACE APIGatewayLambdaAuthorizer:82 - Enter event:

    , context: lambdainternal.api.LambdaContext@4c5474f5
    java.lang.NullPointerException: java.lang.NullPointerException
    java.lang.NullPointerException









    share|improve this question


























      0












      0








      0








      I have configured a custom lambda authorizer of REQUEST type. I have added 4 new custom request headers as Identity source at API --> Authorizers --> Identity Sources and 1 default Authorization. So in total there are 5.



      When I make a call to the API which has the above authorizer configured, the authorizer is being called twice. First time with values to all parameters in the event object second time with empty event object.



      Since event object is null, my code is throwing null pointer even though first time validated claims successfully and returned Allow policy.



      Initially I tried with token type authorizer but token alone itself was not enough for me to verify. Token type works just fine. I.e. there is no 2nd request made.
      When I moved to REQUEST type I started seeing this issue.



      Below are logs from cloudwatch



      2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad DEBUG APIGatewayLambdaAuthorizer:92 - Sucess: Request authorized
      2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad TRACE APIGatewayLambdaAuthorizer:103 - Exit: Policy generated: policyDocument=Version=2012-10-17, Statement=[Action=execute-api:Invoke, Resource=arn:aws:execute-api:us-east-2:851424344156:67w9c9wojb/stage/GET/, Effect=Allow], principalId=yC98Q4Edda9QqwYVkkhe75sUR8SS25pK@clients
      2019-03-28 05:53:33 090465d8-2c04-4869-83fb-cdcde53d33b7 TRACE APIGatewayLambdaAuthorizer:82 - Enter event:

      , context: lambdainternal.api.LambdaContext@4c5474f5
      java.lang.NullPointerException: java.lang.NullPointerException
      java.lang.NullPointerException









      share|improve this question














      I have configured a custom lambda authorizer of REQUEST type. I have added 4 new custom request headers as Identity source at API --> Authorizers --> Identity Sources and 1 default Authorization. So in total there are 5.



      When I make a call to the API which has the above authorizer configured, the authorizer is being called twice. First time with values to all parameters in the event object second time with empty event object.



      Since event object is null, my code is throwing null pointer even though first time validated claims successfully and returned Allow policy.



      Initially I tried with token type authorizer but token alone itself was not enough for me to verify. Token type works just fine. I.e. there is no 2nd request made.
      When I moved to REQUEST type I started seeing this issue.



      Below are logs from cloudwatch



      2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad DEBUG APIGatewayLambdaAuthorizer:92 - Sucess: Request authorized
      2019-03-28 05:53:33 b78955e6-c072-4ada-945f-c8d34490d2ad TRACE APIGatewayLambdaAuthorizer:103 - Exit: Policy generated: policyDocument=Version=2012-10-17, Statement=[Action=execute-api:Invoke, Resource=arn:aws:execute-api:us-east-2:851424344156:67w9c9wojb/stage/GET/, Effect=Allow], principalId=yC98Q4Edda9QqwYVkkhe75sUR8SS25pK@clients
      2019-03-28 05:53:33 090465d8-2c04-4869-83fb-cdcde53d33b7 TRACE APIGatewayLambdaAuthorizer:82 - Enter event:

      , context: lambdainternal.api.LambdaContext@4c5474f5
      java.lang.NullPointerException: java.lang.NullPointerException
      java.lang.NullPointerException






      amazon-web-services aws-api-gateway auth0 lambda-authorizer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 6:11









      user1576882user1576882

      651 gold badge3 silver badges12 bronze badges




      651 gold badge3 silver badges12 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          I really do not know what was the issue. So re-created a new lambda authorizer of request type and it is working fine :(






          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/4.0/"u003ecc by-sa 4.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%2f55391143%2faws-custom-lamba-authorizer-called-twice-for-single-request-from-client-with-emp%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









            0
















            I really do not know what was the issue. So re-created a new lambda authorizer of request type and it is working fine :(






            share|improve this answer





























              0
















              I really do not know what was the issue. So re-created a new lambda authorizer of request type and it is working fine :(






              share|improve this answer



























                0














                0










                0









                I really do not know what was the issue. So re-created a new lambda authorizer of request type and it is working fine :(






                share|improve this answer













                I really do not know what was the issue. So re-created a new lambda authorizer of request type and it is working fine :(







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 28 at 12:05









                user1576882user1576882

                651 gold badge3 silver badges12 bronze badges




                651 gold badge3 silver badges12 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















                    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%2f55391143%2faws-custom-lamba-authorizer-called-twice-for-single-request-from-client-with-emp%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

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript