amplify-js: weird sign-in error: 'null failed with error Generate callenges lambda cannot be called.'

This occurs when a valid user is signing in with a blank password (we’re using a custom sign-in react component)

“aws-amplify”: “1.0.6”, “aws-amplify-react”: “1.0.6”

Window debug messages:

[DEBUG] 14:29.772 AuthClass - signIn failure:
code: "UnexpectedLambdaException"
message: "null failed with error Generate callenges lambda cannot be called.."
name: "UnexpectedLambdaException"

[DEBUG] 14:29.773 Analytics - on hub capsule auth:
data:
  code: "UnexpectedLambdaException"
  message: "null failed with error Generate callenges lambda cannot be called.."
  name: "UnexpectedLambdaException"
event: "signIn_failure"

I am mapping the error to something more meaningful for the user as a workaround for now.

if(/null.*error/.test(message)) {    return "Incorrect username or password"; }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 26
  • Comments: 30 (1 by maintainers)

Most upvoted comments

I’d definitely call this a bug. In a world where password managers are becoming increasingly common, a form has to support copy/paste.

Same here +1

So I’m not sure if I can speak for the other parts of the package, but here’s some info and findings from debugging the aws-amplify-angular side of things. 😃

The issue:

Only a (keyup) event is being used on the username/password inputs, which after the field takes focus and you paste a string into it, would fire the event for the current content of the input, leaving you with the exact same value. https://github.com/aws-amplify/amplify-js/blob/cdcdb69412ee9a980e98745247145d38e953a57c/packages/aws-amplify-angular/src/components/authenticator/sign-in-component/sign-in.component.ionic.ts#L35

To solve it:

Personally, I had some other issues with the UI of the plugin that I had to curb a couple weeks ago, so I made my own customized UI, based off the Amplify code, but just so I could tinker with the styling, input field naming, etc a little easier.

Angular can handle (paste) events. Slap that on your input, and have some code handle the ClipboardData object that gets returned from this event. (Some decent code I found was here).

I changed the form to be Template-Driven, which handles the input changes and events firing better than what’s in the code already. Maybe there’s a reason why it’s neither model bound or reactive, but meh.

Lastly, I suggest the same for now as @stefan-lz suggested to suppress the terrible error:

if(/null.*error/.test(message)) { return “Incorrect username or password”; }

Will see if I can get the time and add a PR into this project to get this sorted…

Still seeing this on 1.1.6-unstable.2, Unable to use passwordless login.