Cognito User Migration Trigger - Exception during user migration - Exception Location










0















We're using a lambda function to respond to the 'User Migration' trigger in AWS Cognito. When something like a syntax error occurs, you can see it in cloud watch logs. However, "Exception during user migration" errors seen on the login page are no where to be found in the cloud watch logs.



Where are we supposed to look for these? I can't find any anything in the documentation and assumed it would have gone to cloud watch.



I can't test it in the lambda interface because one of the parameters being passed into the lambda function will have a function nested within the object and I can't create a test JSON setup that has that. There's also no test trigger for user migration that is pre-built.



Any ideas as to why I can't see this in cloud watch or where the exceptions would be shown would be greatly appreciated.










share|improve this question




























    0















    We're using a lambda function to respond to the 'User Migration' trigger in AWS Cognito. When something like a syntax error occurs, you can see it in cloud watch logs. However, "Exception during user migration" errors seen on the login page are no where to be found in the cloud watch logs.



    Where are we supposed to look for these? I can't find any anything in the documentation and assumed it would have gone to cloud watch.



    I can't test it in the lambda interface because one of the parameters being passed into the lambda function will have a function nested within the object and I can't create a test JSON setup that has that. There's also no test trigger for user migration that is pre-built.



    Any ideas as to why I can't see this in cloud watch or where the exceptions would be shown would be greatly appreciated.










    share|improve this question


























      0












      0








      0








      We're using a lambda function to respond to the 'User Migration' trigger in AWS Cognito. When something like a syntax error occurs, you can see it in cloud watch logs. However, "Exception during user migration" errors seen on the login page are no where to be found in the cloud watch logs.



      Where are we supposed to look for these? I can't find any anything in the documentation and assumed it would have gone to cloud watch.



      I can't test it in the lambda interface because one of the parameters being passed into the lambda function will have a function nested within the object and I can't create a test JSON setup that has that. There's also no test trigger for user migration that is pre-built.



      Any ideas as to why I can't see this in cloud watch or where the exceptions would be shown would be greatly appreciated.










      share|improve this question
















      We're using a lambda function to respond to the 'User Migration' trigger in AWS Cognito. When something like a syntax error occurs, you can see it in cloud watch logs. However, "Exception during user migration" errors seen on the login page are no where to be found in the cloud watch logs.



      Where are we supposed to look for these? I can't find any anything in the documentation and assumed it would have gone to cloud watch.



      I can't test it in the lambda interface because one of the parameters being passed into the lambda function will have a function nested within the object and I can't create a test JSON setup that has that. There's also no test trigger for user migration that is pre-built.



      Any ideas as to why I can't see this in cloud watch or where the exceptions would be shown would be greatly appreciated.







      amazon-web-services aws-lambda amazon-cognito






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 17:17









      John Rotenstein

      70.6k781125




      70.6k781125










      asked Nov 13 '18 at 21:49









      polygonepolygone

      168112




      168112






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Unfortunately Cogntio doesn't expose any logs (or metrics, for that matter!).



          The closest you can get is to view the lambda's logs in CloudWatch. If you log your response, and watch your lambda's error metric then you should mostly be able to debug issues internal to the lambda.



          This does leave a few edge cases:



          • You won't see anything if the lambda can't be invoked (this would only happen under heavy concurrent loads either on that single lambda, or on all lambdas across your account)

          • If you return a bad response the lambda will succeed but the trigger action will fail and Cognito will give you a fairly generic message. At this point you're at the mercy of AWS' documentation to work out what's wrong (which can be a bit hit and miss- although StackOverflow always helps!).

          You can find an example payload for the lambda in the trigger documentation:




          "userName": "THE USERNAME",
          "request":
          "password": "THE PASSWORD"
          ,
          "response":
          // it is your responsibility to fill this bit in and return the completed object back:
          "userAttributes":
          "string": "string",
          ...
          ,
          "finalUserStatus": "string",
          "messageAction": "string",
          "desiredDeliveryMediums": [ "string", ... ],
          "forceAliasCreation": boolean




          n.b. As an aside, which you might know, but Lambda payloads always have to be in JSON, which does not store functions. So you should always be able to derive a test payload to use in the console.






          share|improve this answer























          • Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

            – polygone
            Nov 14 '18 at 14:45












          • ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

            – polygone
            Nov 14 '18 at 14:50











          • Ahh- yes- I get you now. Good luck!

            – thomasmichaelwallace
            Nov 14 '18 at 14:53










          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%2f53290022%2fcognito-user-migration-trigger-exception-during-user-migration-exception-loc%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









          1














          Unfortunately Cogntio doesn't expose any logs (or metrics, for that matter!).



          The closest you can get is to view the lambda's logs in CloudWatch. If you log your response, and watch your lambda's error metric then you should mostly be able to debug issues internal to the lambda.



          This does leave a few edge cases:



          • You won't see anything if the lambda can't be invoked (this would only happen under heavy concurrent loads either on that single lambda, or on all lambdas across your account)

          • If you return a bad response the lambda will succeed but the trigger action will fail and Cognito will give you a fairly generic message. At this point you're at the mercy of AWS' documentation to work out what's wrong (which can be a bit hit and miss- although StackOverflow always helps!).

          You can find an example payload for the lambda in the trigger documentation:




          "userName": "THE USERNAME",
          "request":
          "password": "THE PASSWORD"
          ,
          "response":
          // it is your responsibility to fill this bit in and return the completed object back:
          "userAttributes":
          "string": "string",
          ...
          ,
          "finalUserStatus": "string",
          "messageAction": "string",
          "desiredDeliveryMediums": [ "string", ... ],
          "forceAliasCreation": boolean




          n.b. As an aside, which you might know, but Lambda payloads always have to be in JSON, which does not store functions. So you should always be able to derive a test payload to use in the console.






          share|improve this answer























          • Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

            – polygone
            Nov 14 '18 at 14:45












          • ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

            – polygone
            Nov 14 '18 at 14:50











          • Ahh- yes- I get you now. Good luck!

            – thomasmichaelwallace
            Nov 14 '18 at 14:53















          1














          Unfortunately Cogntio doesn't expose any logs (or metrics, for that matter!).



          The closest you can get is to view the lambda's logs in CloudWatch. If you log your response, and watch your lambda's error metric then you should mostly be able to debug issues internal to the lambda.



          This does leave a few edge cases:



          • You won't see anything if the lambda can't be invoked (this would only happen under heavy concurrent loads either on that single lambda, or on all lambdas across your account)

          • If you return a bad response the lambda will succeed but the trigger action will fail and Cognito will give you a fairly generic message. At this point you're at the mercy of AWS' documentation to work out what's wrong (which can be a bit hit and miss- although StackOverflow always helps!).

          You can find an example payload for the lambda in the trigger documentation:




          "userName": "THE USERNAME",
          "request":
          "password": "THE PASSWORD"
          ,
          "response":
          // it is your responsibility to fill this bit in and return the completed object back:
          "userAttributes":
          "string": "string",
          ...
          ,
          "finalUserStatus": "string",
          "messageAction": "string",
          "desiredDeliveryMediums": [ "string", ... ],
          "forceAliasCreation": boolean




          n.b. As an aside, which you might know, but Lambda payloads always have to be in JSON, which does not store functions. So you should always be able to derive a test payload to use in the console.






          share|improve this answer























          • Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

            – polygone
            Nov 14 '18 at 14:45












          • ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

            – polygone
            Nov 14 '18 at 14:50











          • Ahh- yes- I get you now. Good luck!

            – thomasmichaelwallace
            Nov 14 '18 at 14:53













          1












          1








          1







          Unfortunately Cogntio doesn't expose any logs (or metrics, for that matter!).



          The closest you can get is to view the lambda's logs in CloudWatch. If you log your response, and watch your lambda's error metric then you should mostly be able to debug issues internal to the lambda.



          This does leave a few edge cases:



          • You won't see anything if the lambda can't be invoked (this would only happen under heavy concurrent loads either on that single lambda, or on all lambdas across your account)

          • If you return a bad response the lambda will succeed but the trigger action will fail and Cognito will give you a fairly generic message. At this point you're at the mercy of AWS' documentation to work out what's wrong (which can be a bit hit and miss- although StackOverflow always helps!).

          You can find an example payload for the lambda in the trigger documentation:




          "userName": "THE USERNAME",
          "request":
          "password": "THE PASSWORD"
          ,
          "response":
          // it is your responsibility to fill this bit in and return the completed object back:
          "userAttributes":
          "string": "string",
          ...
          ,
          "finalUserStatus": "string",
          "messageAction": "string",
          "desiredDeliveryMediums": [ "string", ... ],
          "forceAliasCreation": boolean




          n.b. As an aside, which you might know, but Lambda payloads always have to be in JSON, which does not store functions. So you should always be able to derive a test payload to use in the console.






          share|improve this answer













          Unfortunately Cogntio doesn't expose any logs (or metrics, for that matter!).



          The closest you can get is to view the lambda's logs in CloudWatch. If you log your response, and watch your lambda's error metric then you should mostly be able to debug issues internal to the lambda.



          This does leave a few edge cases:



          • You won't see anything if the lambda can't be invoked (this would only happen under heavy concurrent loads either on that single lambda, or on all lambdas across your account)

          • If you return a bad response the lambda will succeed but the trigger action will fail and Cognito will give you a fairly generic message. At this point you're at the mercy of AWS' documentation to work out what's wrong (which can be a bit hit and miss- although StackOverflow always helps!).

          You can find an example payload for the lambda in the trigger documentation:




          "userName": "THE USERNAME",
          "request":
          "password": "THE PASSWORD"
          ,
          "response":
          // it is your responsibility to fill this bit in and return the completed object back:
          "userAttributes":
          "string": "string",
          ...
          ,
          "finalUserStatus": "string",
          "messageAction": "string",
          "desiredDeliveryMediums": [ "string", ... ],
          "forceAliasCreation": boolean




          n.b. As an aside, which you might know, but Lambda payloads always have to be in JSON, which does not store functions. So you should always be able to derive a test payload to use in the console.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 9:14









          thomasmichaelwallacethomasmichaelwallace

          2,5951917




          2,5951917












          • Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

            – polygone
            Nov 14 '18 at 14:45












          • ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

            – polygone
            Nov 14 '18 at 14:50











          • Ahh- yes- I get you now. Good luck!

            – thomasmichaelwallace
            Nov 14 '18 at 14:53

















          • Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

            – polygone
            Nov 14 '18 at 14:45












          • ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

            – polygone
            Nov 14 '18 at 14:50











          • Ahh- yes- I get you now. Good luck!

            – thomasmichaelwallace
            Nov 14 '18 at 14:53
















          Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

          – polygone
          Nov 14 '18 at 14:45






          Thank you for taking the time to respond to this. When I refer to the function being passed in as the payload to the lambda handler, I mean that there's a 'context' object being passed in. It requires you to call a function on it in order to confirm. If you look at this documentation: docs.aws.amazon.com/cognito/latest/developerguide/…

          – polygone
          Nov 14 '18 at 14:45














          ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

          – polygone
          Nov 14 '18 at 14:50





          ... it shows that context has a method on it that I need to call to succeed. That's what I mean when I say I can't mock out the payload with the built-in testing logic that uses only JSON. I think I'm going to step by step comment out code and see if I can debug it that way. Thanks again for your input.

          – polygone
          Nov 14 '18 at 14:50













          Ahh- yes- I get you now. Good luck!

          – thomasmichaelwallace
          Nov 14 '18 at 14:53





          Ahh- yes- I get you now. Good luck!

          – thomasmichaelwallace
          Nov 14 '18 at 14:53

















          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%2f53290022%2fcognito-user-migration-trigger-exception-during-user-migration-exception-loc%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







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto