Lattice Relay Configuration Reference

Every key of relay.yaml, the commands of the lattice tool that manage a relay, the states a delivery goes through, and the limits of a project. Fictional sample written for this portfolio.

The Configuration File

relay.yaml is read at deployment. A key that isn’t listed here makes the deployment fail with unknown key, so a typo can’t silently do nothing.

Top Level

KeyTypeRequiredMeaning
versionintegerYesThe format of the file. Only 1 exists.
namestringYesThe relay’s name. Lowercase letters, digits, and hyphens, up to 40 characters.
sourceobjectYesWhere events come in. See source.
targetslistYesWhere events go. One to five entries. See targets.
retryobjectNoHow failed deliveries are retried. See retry.
dead_letterobjectNoWhat happens to deliveries that run out of attempts. See dead_letter.

Source

KeyTypeDefaultMeaning
pathstring/hooksThe path the sender posts to. Must start with /.
verifystringnoneHow incoming events are checked: none, hmac-sha256, or basic.
secret_fromstringThe environment variable that holds the secret for hmac-sha256, or the user:password pair for basic.
signature_headerstringX-Signature-256The header the sender puts the signature in.
max_body_kbinteger256The largest body the relay accepts. Larger bodies get 413 Payload Too Large.

Targets

Each entry in targets is one destination. The relay delivers every event to every target, and keeps a separate attempt count for each.

KeyTypeDefaultMeaning
namestringA label that appears in delivery listings. Unique within the file.
url_fromstringThe environment variable that holds the target’s HTTPS address.
timeout_secondsinteger10How long the relay waits for the target’s response. 1 to 30.
headersmapExtra headers to send with every delivery. Values may name an environment variable as ${NAME}.
success_codeslist[200, 201, 202, 204]The response codes that count as delivered.

Retry

KeyTypeDefaultMeaning
max_attemptsinteger5Attempts per target, including the first. 1 to 12.
backoffstringexponentialexponential doubles the wait from 5 seconds; fixed waits interval_seconds each time.
interval_secondsinteger30The wait for fixed backoff.
retry_onlist[408, 429, 500, 502, 503, 504]The response codes that lead to a retry. Any other failure code ends the delivery.

dead_letter

KeyTypeDefaultMeaning
keep_daysinteger3How long a failed delivery is kept for replay. 0 to 30.
notify_fromstringAn environment variable with an email address to notify when a delivery fails for good.

Commands

CommandWhat it does
lattice deployReads relay.yaml in the current folder and deploys it to the default project.
lattice env set NAME=valueStores an environment variable, encrypted. Takes effect at the next deployment.
lattice env listLists variable names and when each was last set. Never shows values.
lattice deliveries list [--last N] [--state STATE]Lists deliveries, newest first.
lattice deliveries show IDShows one delivery: every attempt, response code, and duration.
lattice deliveries replay IDSends a delivery again from the dead-letter store.
lattice logs --followStreams the relay’s log.

Delivery States

StateMeaningWhat to do
receivedThe event passed verification and is queued.Nothing. It moves on within a second.
deliveredA target returned a success code.Nothing.
retryingA target failed with a retryable code, and another attempt is scheduled.Check the target if it stays here for more than a few minutes.
failedThe attempts ran out, or the target returned a code that isn’t retried.Fix the target, and then replay the delivery.
rejectedThe event failed verification, or the body was too large.Check the sender’s secret and body size. Rejected events aren’t stored.

Response Codes the Relay Returns to the Sender

CodeMeaning
202 AcceptedThe event is queued. The sender should treat this as success.
401 UnauthorizedThe signature or credentials didn’t match.
404 Not FoundThe path doesn’t match source.path.
413 Payload Too LargeThe body exceeds max_body_kb.
429 Too Many RequestsThe project is over its rate limit. The response carries a Retry-After header.

Limits

LimitDeveloper planTeam plan
Events per minute, per project6006,000
Targets per relay25
Body size256 KB1 MB
Dead-letter retention3 days30 days
Relays per project320