Run amplify add function
and go thru the manual configuration and add access to other resources. Add API here.
Run amplify update api
if you have a project already setup and configure IAM as an additional auth mode.
Add the authorization as following to your type definition:
type Something
@model
@auth(
rules: [
{ allow: private, provider: iam }
]
) {
id: ID!
something: String
}
This allows Lambda to fetch from this type.
- Open the terminal in the
amplify/backend/function/(nameOfYourFunction)/src
directory in your newly created Lambda function. - Run
npm install appsync-client graphql-tag
Change the code as you find in this gist's JavaScript file.
When you are done setting up your Lambda function to your desired result run amplify push
to push your Lambda function to the AWS Cloud.
Hey @renegoretzka, unfortunately, it is not working for me. Mutation
createUser
is returning null with no errors.Here are the steps which I did to setup postConfirmation lambda function: (I want to create a user doc, after the user is confirmed)
amplify update function
and selected thepostConfirmation
function.Result:
Then amplify push.
Lambda code is the same as yours.
but in config variable, it takes accessID, and secretKey from env. right? but I can't see these keys in the lambda console, only
APIENDPOINTOUPUT
andAPIIDOUTPUT
exist.