question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I add Lambda Pipeline Resolver to Type with @model

See original GitHub issue

I am trying to sanitize the WYSIWYG input from the user with https://www.npmjs.com/package/dompurify. After doing some reading, I decided to try adding pipeline lambda resolver to existing
type Record @model @searchable @auth(rules: [{allow: groups, groups: ["sys_admin"], operations:[create, update, delete]}])

I found the tutorial on how to add a custom resolver here : https://aws-amplify.github.io/docs/cli-toolchain/graphql?sdk=js#add-a-custom-resolver-that-targets-an-aws-lambda-function

but not sure how this lambda resolver can be used in Type with @model directive. This was also asked before here: https://github.com/aws-amplify/amplify-cli/issues/867

if removing @model directive is the only option, what steps need to be performed in order to keep the same functionalities?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Nxtracommented, Nov 20, 2020

@monaye Yes, you are right. You can have the @function on a field of a type or in Query for example. The docs has a complete sample about this at: https://aws-amplify.github.io/docs/cli-toolchain/graphql#function

I’m closing the issue, if you have new things to ask feel free to reopen at a later time.

Should we have closed this issue? Or maybe a feature request needs to be created. As I understand the main question of this issue is not resolved yet. It is, to my knowledge, not yet supported to use lambda resolvers on types that are annotated with @model.

Is this on the planning already?

1reaction
Nxtracommented, Nov 20, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Pipeline resolvers (VTL) - AWS AppSync
In the Mutation type on the right side, choose Attach resolver next to the signUp field. On the Create Resolver page, click on...
Read more >
Add Pipeline Resolvers in AWS Amplify - DEV Community ‍ ‍
In this tutorial, you'll learn how to add a pipeline resolver in an ... A lambda function that takes the password field from...
Read more >
How to Create Nested and Pipeline Resolvers with AppSync ...
If you want to learn AppSync in the best way possible check out the course I used to learn it all. Use code...
Read more >
Pipeline resolvers in AppSync - Advanced Web Machinery
To use the functions in a pipeline resolver, add a resolver to a field on the “Schema” page: The pipeline itself is similar...
Read more >
API (GraphQL) - Configure Lambda resolvers - Amplify Docs
You can use the @function directive to write custom business logic in an AWS Lambda function. To get started, use amplify add function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found