aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
87 stars 75 forks source link

Guidance to replace schema generated VTL resolvers with JS resolvers #2211

Open Dennis-Dekker opened 7 months ago

Dennis-Dekker commented 7 months ago

Amplify CLI Version

12.10.1

Question

To enhance the flexibility of Appsync, we are investigating the migration from VTL resolvers to JS resolvers. Despite consulting the documentation for instructions, the implementation process remains unclear. My current approach involves using the custom resource feature of the Amplify CLI to substitute VTL resolvers with JS resolvers. This, however, has presented several challenges.

A primary concern is the limitation imposed by the Code.fromInline function, which constrains the scalability of our JS resolvers. An alternative method that avoids the necessity of embedding extensive code within multiline strings in a single file would be helpful.

The main objective is to replace auto-generated VTL resolvers with JS ones. My initial strategy was to use the CDK stack to create new JS resolvers, naming them identically to their VTL counterparts. This resulted in an error indicating that a resolver for the query/mutation already exists. Altering the approach by preventing Amplify from generating resolvers using "@model(queries: { get: null }, mutations: null, subscriptions: null)" and then adding the resolver led to an error stating "The query/mutation does not exist."

A concise guide on employing JS resolvers within Amplify, particularly for replacing generated ones, would be highly valuable. Additionally, I am interested in understanding Amplify's future plans regarding these updates. The Appsync documentation now primarily supports the APPSYNC_JS runtime, as stated on their page. I am eager to know when this will be integrated into Amplify. Thank you for your attention to this matter.

ykethan commented 7 months ago

Hey, 👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂

Mrrvm commented 7 months ago

+1

dvdschoor commented 7 months ago

Would be very very helpful!

QuintenVerheij commented 7 months ago

+1

Dennis-Dekker commented 7 months ago

Hi, is there any update on this issue? Or does someone have some pointers towards using JS resolvers?