I am running a lambda inside my AWS account that is attempting to run mutations against an AppSync instance in the same account which is authenticated via AWS_IAM. I have created a Role that my lambda assumes which has access to my mutations with the following document:
{
"Action": [
"appsync:GraphQL",
"sts:AssumeRole"
],
"Resource": "arn:aws:appsync:us-west-2:<MyAWSAccountId>:apis/<MyAppSyncAPiId>/types/Mutation/fields/*",
"Effect": "Allow"
},
However, I receive the following error below:
{
data: {},
errors: [
GraphQLError: adapter is not a function
at APIClass.<anonymous> (/var/task/node_modules/@aws-amplify/api/dist/aws-amplify-api.js:4627:24)
at step (/var/task/node_modules/@aws-amplify/api/dist/aws-amplify-api.js:3800:19)
at Object.throw (/var/task/node_modules/@aws-amplify/api/dist/aws-amplify-api.js:3730:14)
at rejected (/var/task/node_modules/@aws-amplify/api/dist/aws- amplify-api.js:3692:32)
at runNextTicks (internal/process/task_queues.js:62:5)
at processImmediate (internal/timers.js:429:9)
at process.topLevelDomainCallback (domain.js:137:15)
]
}
The lambda auth code works when I am running in my test account, and I have verified that the permissions are same between both test account and this account. I have also verified that the account id and api Id are correct and schemas match.
I am a little lost as to what this error signifies since I am using the same libraries in test and production. Is there anything else that could be mismatched in accounts that can result in this error?
After digging online found: https://github.com/aws-amplify/amplify-js/issues/4311#issuecomment-562789876
Using "@aws-amplify/api": "^2.2.0",
caused mismatch error. I ended up downgrading to:
"@aws-amplify/api": "^2.1.0",
as versions greater then > 2.2.0 caused missing identity pool errors.
Final set of dependencies in my package.json:
"@aws-amplify/api": "^2.1.0",
"aws-amplify": "^2.1.0",
"aws-sdk": "^2.6.x",
"aws-appsync": "^2.0.2",
"amazon-cognito-identity-js": "^3.0.x",