Skip to content
Source
Sign inSign up
pingdotgg/t3code

docs(connect): webhook path uses the endpoint key and held hooks are per link #17413

Closedmacodev00(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/17413/headopened View on GitHub

Showing 1 changed file with 18 additions and 12 deletions.

x
0 of 1 viewed, 1 left
18 additions and 12 deletionsdocs/internals/t3-connect.mdModified
View file
@@ -5,29 +5,35 @@
bootstrap, clients send application traffic through the environment's tunnel
hostname; the relay Worker does not proxy their HTTP or WebSocket sessions.
The one exception is automation webhooks: the relay forwards
-`/v1/hooks/:environmentId/:hookId/:token` to the environment's tunnel so
-senders get a stable URL. It keeps bodies and tokens out of its traces and
-leaves token and signature verification to the environment
+`/v1/hooks/:endpointKey/:hookId/:token` to the environment's tunnel so
+senders get a stable URL. `:endpointKey` is the 16-hex key of the link's
+managed tunnel, not the environment id. It keeps bodies and tokens out of its
+traces and leaves token and signature verification to the environment
([forwarder](../../infra/relay/src/hooks/HookForwarder.ts)).
​
By default the forwarder stores nothing. An environment can opt in to having
the relay hold requests while it is offline
(`hold_webhooks_while_offline` on its link). Only then does the relay store the
raw request, including the hook token in the path, in a Durable Object for
-that environment, with SQLite storage. The object pushes held requests back
-through the tunnel from its alarm, oldest first, and backs off while the
-environment stays away. When the tunnel reconnects, the environment asks the
-relay to deliver right away. Requests are deleted once the environment
-answers, after 24 hours, or when no user has the environment linked. The relay
-still never checks the token; delivery goes through the same environment route.
+that link's managed endpoint (named by its endpoint key), with SQLite storage.
+Each link has its own endpoint key, so two accounts that link the same
+environment get separate inboxes. The object pushes held requests back
+through the tunnel from its alarm, oldest first within each hook, and backs
+off while the environment stays away. When the tunnel reconnects, the
+environment asks the relay to deliver right away. A request is deleted once
+the environment answers it with any status other than 429 or 500; those