Description
Environment information
all latest
Description
Here's a use case for DDB lambda trigger with access to graphql. The lambda will process records and update state in the model with GraphQL mutation (careful with the updates since it can cause circular trigger).
Possible to achieve with this example https://docs.amplify.aws/react/build-a-backend/functions/examples/dynamo-db-stream/
However, it currently not possible to deploy, if model's auth includes at least one function (test1 function here) - then adding event source will break with circular dependency problem.
This is because the functions are added into own nested stack, which creates a dependency on data nested stack, which creates a circular dependency when these stacks referenced for event source.
const backend = defineBackend({
auth,
data,
docUploaderFunction,
test1,
});
const eventSource = new DynamoEventSource(
backend.data.resources.tables["Todo"],
{
startingPosition: StartingPosition.LATEST,
batchSize: 5,
}
);
backend.docUploaderFunction.resources.lambda.addEventSource(eventSource);
amp sandbox
...
The CloudFormation deployment has failed.
Caused By: ❌ Deployment failed: Error [ValidationError]: Circular dependency between resources: [data7552DF31, function1351588B]
I think this is a legit bug.
Related: #1594