Deliveries Fail or Stay in Retrying
Events reach the relay, but your application doesn’t get them, or gets them late. Start with lattice deliveries show on one affected delivery: its last attempt names the cause in almost every case. Fictional sample written for this portfolio.
lattice deliveries listshows deliveries in the stateretryingfor more than a few minutes, or infailed.- The sender reports
401 Unauthorizedfrom the relay’s address. - Your application receives the same event twice.
Why It Happens
| What the last attempt says | Cause |
|---|---|
connect: timeout or connect: refused | The target address is wrong, the target is down, or a firewall in front of it doesn’t allow the relay’s addresses. |
502 or 503 from the target | The target is overloaded or restarting. The relay retries these on its own. |
401 or 403 from the target | The target expects a credential the relay doesn’t send. |
signature mismatch on an attempt to your target | Your application verifies Relay-Signature with a different secret from the one the relay signs with. |
rejected: signature mismatch on the incoming event | The secret in RELAY_SOURCE_SECRET differs from the one the sender signs with, or the sender signs a different header. |
| The same event delivered twice | The target took longer than timeout_seconds to answer the first time, so the relay sent it again. |
Fix It
The Target Can’t Be Reached
Procedure
The Target Rejects the Relay
Procedure
Signatures Don’t Match
Procedure
- Confirm which secret each side uses. The relay verifies incoming events with
RELAY_SOURCE_SECRET, and signs outgoing deliveries with the project’s delivery secret, shown once under Settings > Signing in the console. - In your application, verify
Relay-Signaturewith the delivery secret, not with the sender’s secret. The two are different on purpose, so that a leaked sender secret can’t forge deliveries. - Compute the signature over the raw request body, before any JSON parsing. A parser that reorders keys changes the bytes.
Duplicate Deliveries
Procedure
- Make your handler idempotent: store
Relay-Delivery-Idand ignore an id you have already processed. - Answer
202as soon as you have stored the event, and do the work afterwards. A target that answers within a second is never retried for a timeout. - If the work can’t be deferred, raise
timeout_secondsto at most 30.
If None of This Fixes It
Collect the delivery id, the output of lattice deliveries show, and the time of the attempt in UTC. Open a ticket with the Lattice Relay support team from the console’s Help menu, and include the three items. The team can see the relay’s side of each attempt but not your target’s logs, so attach those too.