question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to customize PreSignup error response text in amplify-authenticator

See original GitHub issue

Category

Auth

Amplify CLI Version

4.20.0

This is a Vuejs app.

My PreSignup handler ends with the following:

  if (!allowed) {
    callback("My error message", null);
  } else {
    callback(null, event);
  }

When I run: mock function myPreSignup

Output is:

myPreSignup failed with the following error:
{ '0': 'M',
  '1': 'y',
  '2': ' ',
  '3': 'e',
  '4': 'r',
  '5': 'r',
  '6': 'o',
  '7': 'r',
  '8': ' ',
  '9': 'm',
  '10': 'e',
  '11': 's',
  '12': 's',
  '13': 'a',
  '14': 'g',
  '15': 'e' }

However in the browser the following is displayed in the amplify-toast:

myPreSignup failed with the following error: My error message

How do I remove or change (or preferably translate using i18) the text: “myPreSignup failed with the following error:” ?

I have also tried something like this in my handler:

  if (!allowed) {
    callback({error: 'My error message'}, null);
  } else {
    callback(null, event);
  }

When I try mocking I get this output:

myPreSignup failed with the following error:
{ error: 'My error message' }

Then the coresponding message in the browser amplify-toast is something like:

myPreSignup failed with the following error: [object, object]

Which is not very usefull

What is the correct way of dealing with this ? Is it perhaps possible to overide the signUp() function ? And shouldn’t the mocking output error text look more like the toast output ? (Now it’s confusing)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
man-andycommented, Oct 22, 2020

Any update on this?

1reaction
kjetilgecommented, May 27, 2020

I’ll try to do your suggested workaround for now. At least the front-end now has Norwgian translation 😀

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to customize validation messages in AWS Amplify
In the first one, we used aws-amplify v3.0.23 without Amplify-UI. It shows the following error message if username contains a space:.
Read more >
Managing error responses - Amazon Cognito
Custom error responses are available for user creation and authentication, password recovery, and confirmation operations. Use the PreventUserExistenceErrors ...
Read more >
Customization | Amplify UI for React
Custom Confirm Sign Up footer with a Footer Information message. const components = {. Header() {.
Read more >
Take the Headache Out of Authentication Error Handling With ...
General Setup and Configuration. There's a short checklist of things you need to have/configure before we get started.
Read more >
Enforcing attribute uniqueness in Cognito with AWS Amplify ...
In this walkthrough, you'll learn how create a PreSignUp Lambda for ... Text Message Please specify an SMS authentication message: Your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found