You're using the VTL request_template and response_template variables.
Since you're using JS for the resolver, use the code variable instead.
Check the Example JS section here: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_resolver#example-usage-js