Meris Tarhanis
03/31/2022, 12:30 PMGabriel Araújo
03/31/2022, 12:40 PMGabriel Araújo
03/31/2022, 12:42 PMGabriel Araújo
03/31/2022, 12:43 PMMeris Tarhanis
03/31/2022, 12:45 PMMeris Tarhanis
03/31/2022, 12:45 PMRoss Coundon
03/31/2022, 12:47 PMuserPoolId
, identityPoolId
etc that are output by the stack into the frontend configuration of Amplify.Thomas Ankcorn
03/31/2022, 12:47 PMMeris Tarhanis
03/31/2022, 12:52 PMThomas Ankcorn
03/31/2022, 12:52 PMMeris Tarhanis
03/31/2022, 12:52 PMThomas Ankcorn
03/31/2022, 12:53 PMThomas Ankcorn
03/31/2022, 12:54 PMMeris Tarhanis
03/31/2022, 12:56 PMThomas Ankcorn
03/31/2022, 12:56 PMMeris Tarhanis
03/31/2022, 12:58 PMThomas Ankcorn
03/31/2022, 1:00 PMChainapp Technologies
03/31/2022, 1:09 PMuserPoolId
, identityPoolId,
etc from the Lambda handler. The variables are available in the env for the frontend. How do we get them from the Lambda handler? Besides that, everything works since we are able to SignUp the user when we hardcode the values for the Amplify configGabriel Araújo
03/31/2022, 1:34 PMAmplify.config
part doesn't run on a lambda. It runs when you're building your frontend infra definition. Because it's inside FrontendStack. It isn't a lambda. And that's why you can't get the actual value. Because you're working with INFRA definition. The env is available for the Frontend(react project) because the outputted cloud formation can handle future reference.
• auth.cognitoUserPool.userPoolId
may not exists because aws did not create it when you run Amplify.config. It's like a chicken-egg problem.
• It works when you hardcoded the values because the resource already exists and you put the values there. But this is not always the case when you are deploying the first time/working with cdk (infra definition)
• I recommend trying to identify what is infra as code and what is runtime code (application logic). And not mix it.
This is how I understand your question. Sorry if I got it wrong. I hope it helps. Need to go now... see youDerek Kershner
03/31/2022, 1:51 PMChainapp Technologies
03/31/2022, 2:01 PMconst result = await Auth.signUp({
username: cellphone_number,
password,
})
Gabriel Araújo
03/31/2022, 3:29 PMsrc/create.main
) You can get the HTTP params. Store it in your database. And call Cognito.
• Im not sure if amplify will run on lambda code.
• What I recommend is using AWS SDK Cognito to call Cognito APIs and creates the user. You can find the documentation here for v3:
◦ Homepage: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cognito-identity-provider/index.html
◦ SingUp an user: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cognito-identity-provider/classes/signupcommand.html
◦ Admin Confirm SignUp an user if you want to confirm it: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cognito-identity-provider/classes/adminconfirmsignupcommand.html
• You can pass the cognito ids to use it in the lambda handlers via environments variable: like here https://docs.serverless-stack.com/constructs/Api#specifying-function-props-for-all-the-routes
You'll then have an endpoint to call e.g: "`https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/my-endpoint-address`"
That can perform what you defined in the handler file.Chainapp Technologies
03/31/2022, 5:11 PM