not at all lol, i barely know what i'm doing and was following along just to try to learn about this new feature π
i think the struggle i had was how to use direct lambda resolvers in mutations not just queries. i couldnt figure out how to do it. maybe worth a followup post?
@nxtra
, in order to do this for a mutation, you'd set the typeName: Mutation and fieldName: yourMutationName. Query, Mutation and Subscription are really just a Type like Todo.
The one gotcha is that you can't create a resolver on a mutation that already has one. Example being createToDo. Amplify has already created a resolver for it inside CloudFormation. You'll need to either to add @model(mutations: null) so you can override it or create a custom mutation. I prefer the custom mutation because then I still have access to the autogenerated vtl from Amplify. There are times where the authorization rules that are generated in the response.vtl can still be useful.
Thanks for the info! I didn't realize yet that indeed a resolver with that name already exists if you name it like that.
Until now I've been making custom Resolvers with lambda functions as pipeline resolvers. I'll try to convert one to a "no-more-vtl" version using your guide.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you Shawn for catching this, it's a treat just to have you actually use this code!
not at all lol, i barely know what i'm doing and was following along just to try to learn about this new feature π
i think the struggle i had was how to use direct lambda resolvers in mutations not just queries. i couldnt figure out how to do it. maybe worth a followup post?
Pfffh, you got it. I'll whip something up for this week.
Did you guys manage to figure this out?
@nxtra , in order to do this for a mutation, you'd set the
typeName: Mutation
andfieldName: yourMutationName
. Query, Mutation and Subscription are really just aType
likeTodo
.The one gotcha is that you can't create a resolver on a mutation that already has one. Example being
createToDo
. Amplify has already created a resolver for it inside CloudFormation. You'll need to either to add@model(mutations: null)
so you can override it or create a custom mutation. I prefer the custom mutation because then I still have access to the autogenerated vtl from Amplify. There are times where the authorization rules that are generated in the response.vtl can still be useful.Thanks for the info! I didn't realize yet that indeed a resolver with that name already exists if you name it like that.
Until now I've been making custom Resolvers with lambda functions as pipeline resolvers. I'll try to convert one to a "no-more-vtl" version using your guide.