Hi everyone! 👋
What I deployed: a Trigger.dev automation that watches my Shopify store for new newsletter signups and automatically sends each one a branded welcome discount. It runs on a schedule every 30 minutes (plus instant webhooks), around the clock. Screenshot: 24 runs, 0 failed. What it does (one sentence): every new subscriber gets a personal welcome discount code in their inbox within minutes, without me touching anything.
One thing that broke: some people got the same welcome email up to 8 times. 😅
Every task retries on failure, and a retry re-runs the whole task body, so each retry fired the email again. Claude Code traced it and routed every send through one shared function with a Resend Idempotency-Key (event type + customer id).
Same key within 24h means Resend returns the original instead of sending again.
One email per person, guaranteed, even under retries or duplicate webhooks.