Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amplify auth update makes "Email Verification Link with Redirect" not working #5720

Closed
yaquawa opened this issue Oct 28, 2020 · 12 comments
Closed
Labels
auth Issues tied to the auth category of the CLI dependency-issue Issue with another dependency used

Comments

@yaquawa
Copy link

yaquawa commented Oct 28, 2020

Describe the bug
I was able to sign up a user with the following code

import { Auth } from 'aws-amplify'

Auth.signUp({
  username: email,
  password: password,
  attributes: {
    email: email,
  },
})

The email has been sent correctly but,

  1. the email body is not the same as what I have configured.
  2. the link is 404 not found

here is the email body(a dot + URL):

. http://verificationbucket-develop.s3-website-ap-northeast-1.amazonaws.com/?data=eyJ1c2VyTmFtZSI6ImEyZTU1NWVhLTVkZTctNGRiOC04ODg3LTAxN2NlMWYzMGQyNiIsInJlZGlyZWN0VXJsIjoiLz91c2VybmFtZT1hMmU1NTVlYS01ZGU3LTRkYjgtODg4Ny0wMTdjZTFmMzBkMjYiLCJyZWdpb24iOiJhcC1ub3J0aGVhc3QtMSIsImNsaWVudElkIjoiN25tYXQ4bDZodWcyaWcyMGFtaWpjY20wNzQifQ==&code=407755

I couldn't find any information about the "Email Verification Link with Redirect".
Have I missed something else?
What I want to achieve is that after user clicked on the link in the email, the user authenticated automatically and redirect to the "You are authenticated!" page on my site.

Amplify CLI Version
4.31.1

To Reproduce

amplify auth update
...
...
 Do you want to enable any of the following capabilities? (Press <space> to select, <a> to toggle all, <i> to invert selection)
 ◯ Add Google reCaptcha Challenge
❯ ● Email Verification Link with Redirect
 ◯ Add User to Group
 ◯ Email Domain Filtering (blacklist)
 ◯ Email Domain Filtering (whitelist)
 ◯ Custom Auth Challenge Flow (basic scaffolding - not for production)

amplify auth push
@jhockett jhockett added auth Issues tied to the auth category of the CLI pending-triage Issue is pending triage labels Oct 28, 2020
@UnleashedMind UnleashedMind added dependency-issue Issue with another dependency used and removed pending-triage Issue is pending triage labels Oct 30, 2020
@UnleashedMind
Copy link
Contributor

UnleashedMind commented Oct 30, 2020

@yaquawa
Copy link
Author

yaquawa commented Oct 30, 2020

@UnleashedMind Thanks for the links.
But that's not what I want to know about. I understand I can do the same thing with out Amplify, here I'm asking is the "Amplify way" to do it. That is to do it with the "Email Verification Link with Redirect" option, which set the trigger by Amplify(infrastructure as code). But I'm meeting the issue what I have described here, that's why I opened this issue.

@yaquawa
Copy link
Author

yaquawa commented Nov 2, 2020

Hi Amplify team,
I want to know if it's possible to make "Email Verification Link with Redirect" option work.
I have to make a decision for this. If this is a bug and won't be fixed soon, I'll do it manually.
Thanks.

@UnleashedMind
Copy link
Contributor

@yaquawa
This is a dependency issue on Cognito, we won't be able to fix it on the Amplify CLI side. You will need to use some of the workarounds that I listed in the above response.

@yaquawa
Copy link
Author

yaquawa commented Nov 3, 2020

@UnleashedMind
The links you given me has nothing to do with the option "Email Verification Link with Redirect".
Even the docs doesn't has any information for this. Is this option a dead feature?
Could you give me more info on this option? Thanks.

@yaquawa
Copy link
Author

yaquawa commented Nov 9, 2020

Any update on this?

@yaquawa
Copy link
Author

yaquawa commented Nov 9, 2020

I think I found the issue now.
I found the Environment variables for the lambda function generated by this option was set to blank, how to fix this?

  • EMAILMESSAGE
  • EMAILSUBJECT
  • REDIRECTURL
  • RESOURCENAME

@yaquawa
Copy link
Author

yaquawa commented Nov 9, 2020

I tried editing this file:
amplify/backend/function/myproject2713aa05CustomMessage/function-parameters.json

The original content of this file was:
(notice that the triggerEnvs is a string but not an array.)

{
  "trigger": true,
  "modules": [
    "verification-link"
  ],
  "parentResource": "minaoshi2713aa05",
  "functionName": "minaoshi2713aa05CustomMessage",
  "resourceName": "minaoshi2713aa05CustomMessage",
  "parentStack": "auth",
  "triggerEnvs": "[\n  {\n    \"key\": \"RESOURCENAME\",\n    \"value\": \"resourceName\"\n  }\n]",
  "triggerDir": "/Users/wang/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/provider-utils/awscloudformation/triggers/CustomMessage",
  "triggerTemplate": "CustomMessage.json.ejs",
  "roleName": "minaoshi2713aa05CustomMessage",
  "skipEdit": true,
  "REDIRECTURL": "https://3naoshi.com/",
  "EMAILSUBJECT": "account confirm",
  "EMAILMESSAGE": "click the follwoing links",
  "RESOURCENAME": "resourceName",
  "enableCors": false,
  "triggerEventPath": "CustomMessage.event.json"
}

I just changed the triggerEnvs to

"triggerEnvs": [
        {
            "key": "RESOURCENAME",
            "value": "resourceName"
        }
    ],

then the issue gone.

I noticed that if I run a amplify update auth, the amplify/backend/function/myproject2713aa05CustomMessage/function-parameters.json goes back to the stringified version again... This must be a bug.

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Dec 26, 2020

This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems.

@stale stale bot closed this as completed Dec 26, 2020
@yaquawa
Copy link
Author

yaquawa commented Jan 15, 2021

Still hit the same issue... will this be fixed someday?

@yaquawa yaquawa changed the title auth with "Email Verification Link with Redirect" selected not working amplify auth update makes "Email Verification Link with Redirect" not working Jan 15, 2021
@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auth Issues tied to the auth category of the CLI dependency-issue Issue with another dependency used
Projects
None yet
Development

No branches or pull requests

3 participants