I'm designing a rate-limiting workflow with an SQS queue. A client durable Lambda places a request on the queue and waits for a callback. A server durable Lambda consumes the queue with maximum concurrency set to 1, checks when the rate-limited resource was last used, waits if necessary, and then performs the operation before invoking the callback.
I'm defining this with the AWS CDK. The following setup worked previously for a regular Lambda consuming SQS:
const mapping = new sources.SqsEventSource(bggQueue, { batchSize: 1, enabled: false });
bggLambda.addEventSource(mapping);
However, creating the event source mapping fails with an error saying that a durable function cannot be invoked using an unqualified ARN. I understand that durable functions require a specific qualified version or alias, but I'm not sure how to express that through the CDK Function object. What is the correct way to attach the SQS event source to the durable Lambda?
2 Answers
If the higher-level CDK construct does not expose everything you need, use the L1 `CfnEventSourceMapping` resource. It lets you provide the event source ARN and a qualified function ARN explicitly. For this case, though, using a published version or alias through the Function object should normally be enough.
Double-check whether a durable Lambda is necessary for the rate limiter. An SQS consumer with reserved or maximum concurrency of one, combined with visibility timeout and retry handling, may be sufficient depending on how long the wait and callback workflow lasts. If the function genuinely needs durable execution semantics, make sure the event source targets a qualified version or alias.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically