* Which Category is your question related to? *
Subscriptions
* What AWS Services are you utilizing? *
Lambda, AppSync, Dynamo
* Provide additional details e.g. code snippets *
The goal is to insert data through a lambda function and have it send a subscription event. When using the client side library to insert using a graphql mutation, a subscription is sent to those listening. But if you insert from a lambda using the sdk libraries, it won't.
I have not tried it but I assume we can use Amplify in lambda. Is there a way to inherit the user login? or do we need to create a cognito user? Maybe there's a different way to fire an event?
Hi @rawadrifai
You can find an example on how to do this in the docs (GraphQL from Lambda
)
Please note that using Amplify in node is not fully supported but some use cases work (YMMV). This specific one, it is better to use the lambda provided in the docs.
I hope this helps
Does help @manueliglesias. Thank you.
@manueliglesias question: if I am using a lambda as a custom resolver, i.e. type Mutation, to insert data in a dynamo table, do you know how I can have it also generate the necessary events like onCreateTodo? I'm using the dynamodb sdk to insert the data.
@manueliglesias @rawadrifai hey guys, did you make it work? I followed an article in the docs and I managed to run mutation successfully (I see changes in DynamoDB). However, my frontend app never received a subscription event connected to this mutation that I run in Lambda. How do I debug this?
Running into the same issue @sorokinvj have you heard anything or figured this out yet?
Running into the same issue @sorokinvj have you heard anything or figured this out yet?
I did! Basically, followed advices on the bottom of the comments in this issue
https://github.com/aws-amplify/amplify-cli/issues/1678#issuecomment-589268180
Most helpful comment
@manueliglesias @rawadrifai hey guys, did you make it work? I followed an article in the docs and I managed to run mutation successfully (I see changes in DynamoDB). However, my frontend app never received a subscription event connected to this mutation that I run in Lambda. How do I debug this?