aws-amplify / aws-amplify/amplify-cli
How to configure to use LambdaAuthorizer for custom VTL resolvers query?
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Amplify CLI Version
14.2.5
### Question
Hi, i can not manage Lambda Authorizer appsync auth for my custom query `getComponentFiltered(id: ID!, organizationID: String): Component` , which is using custom resolvers created with `amplify add custom` and then selecting CDK option. My custom VTL resolvers are created in backend and present locally in '`amplify\backend\custom\CustomResolvers\`' folder along with 'cdk-stack.ts' and *.vtl files
real problem: when i invoke this query (either from client or from appsync web-console with a selection of Lambda Authorizer) i'm getting this error:
```json
{
"data": {
"getComponentFiltered": null
},
"errors": [
{
"path": [
"getComponentFiltered"
],
"data": null,
"errorType": "Unauthorized",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 3,
"sourceName": null
}
],
"message": "Not Authorized to access getComponentFiltered on type Query"
}
]
}
```
my appsync has been set-up with Cognito UserPool as a default authorization method, with AWS_LAMBDA as a secondary method.
I tried adding `@aws_lambda @aws_cognito_user_pools` directives to my query in schema.graphql, but it leads to the fact that my custom resolvers are not detected anymore, as it seems appsync auto-generates own VTL templates based on these directives.
My question: is there a way to attach both AWS_LAMBDA and UserPool authentication capabilities to custom query with custom resolvers?
I am using Amplify JS Gen.1 v6 API (Transformer v2)
Contributor guide
Assessment
This issue has not been assessed yet.