https://pulumi.com logo
Title
s

steep-lamp-20408

10/24/2022, 8:08 AM
Hello! I am blocked since a few days while trying to create a way to create a direct lambda resolver to invoke an AWS lambda (https://aws.amazon.com/blogs/mobile/appsync-direct-lambda/) with Pulumi. According to several online resources it seems we still need a basic resolver when doing it with an IaC tool/Terraform (https://github.com/hashicorp/terraform-provider-aws/issues/14488#issuecomment-678101695). So here is my graphQL schema :
type Mutation @aws_api_key @aws_oidc {
inviteUser(
    email: String!
    organizationId: ID!
    referrerUserId: ID!
  ): User
}
...and here is my resolver creation Pulumi code, knowing the Appsync API (
my_appsync_api
) lambda and its datasource (
my_lambda_datasource
) are already created successfully:
import pulumi_aws as aws

my_resolver = aws.appsync.Resolver(
    "my-resolver",
    api_id=my_appsync.id,
    type="Mutation",
    field="inviteUser",
    data_source=my_lambda_datasource.name,
    request_template="""
    {
        "version": "2017-02-28",
        "operation": "Invoke",
        "payload": {
            "arguments": $utils.toJson($ctx.args)
        }
    }
    """,
    response_template="""
    ## Raise a GraphQL field error in case of a datasource invocation error
    #if($ctx.error)
        $util.error($ctx.error.message, $ctx.error.type)
    #end
    $util.toJson($ctx.result)
    """,
)
On Pulumi up, I get the error:
error creating AppSync Resolver: NotFoundException: No field named inviteUser found on type Mutation
What is/should be
field
in the case of direct invocation? Any idea?