Commit b065509
committed
fix(webapp): row-optional session-channel routes default to org basin
PUT /realtime/v1/sessions/:session/:io and the SSE GET loader on the
same path are row-optional — `:session` may be a `chatId` (externalId)
that hasn't been upserted yet. When the row is missing, both used to
fall through `resolveStreamBasin` to the legacy global basin. If the
row was then created with a per-org basin stamp, follow-up appends and
SSE subscribes resolved to per-org while the PUT-returned headers
still pointed at legacy — caller writes via those headers landed in
the wrong place.
Resolve via the org's current basin when the row is absent. A fresh
session row would be stamped with that same basin at create time, so
all subsequent ops converge. Pre-migration rows (row exists, column
null) keep their legacy fallback because `organization` is only passed
in the no-row branch — `session.streamBasinName === null` still falls
through to the env var, not to the org column.
Verified by curl: PUT against a fresh externalId for an org with a
per-org basin returns `X-S2-Basin: triggerdotdev-dev-org-<orgId>`;
same call for a free-org key still returns the legacy basin.1 parent 871b993 commit b065509
2 files changed
Lines changed: 26 additions & 1 deletion
File tree
- apps/webapp/app
- routes
- services/realtime
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 | | |
63 | 72 | | |
| 73 | + | |
64 | 74 | | |
65 | 75 | | |
66 | 76 | | |
| |||
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
127 | 141 | | |
128 | 142 | | |
| 143 | + | |
129 | 144 | | |
130 | 145 | | |
131 | 146 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| 67 | + | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
| |||
0 commit comments