Commit a0ca089
fix: guard REACTOR_ADDRESS_MAPPING[chainId] against undefined (#669)
PR #654 expanded SUPPORTED_CHAINS from 7 to 18, but not every new chain
has an entry in the SDK's REACTOR_ADDRESS_MAPPING. Five call sites
indexed REACTOR_ADDRESS_MAPPING[chainId][orderType] without guarding the
parent, so an unmapped chain produced
"TypeError: Cannot read properties of undefined (reading 'Relay')".
EventWatcherMap.createRelayEventWatcherMap() runs at module load of
get-orders/index.ts. With beta provisioned concurrency reset to 0
(#666), every cold start re-evaluated the module, the TypeError aborted
init, and API Gateway surfaced 502s for requests that should have been
4xx (e.g. e2e Error Handling > should handle invalid parameters).
Optional-chain the lookups so unmapped chains fall through to existing
guard branches:
- EventWatcherMap: skip the chain instead of throwing at module load.
- OffChain{Relay,UniswapX}OrderValidator: return "Invalid reactor
address" (400) instead of TypeError (500).
- check-order-status/util.getWatcher: existing throw fires with the
intended message instead of a TypeError.
- gs-reaper.processBlockRange: short-circuit the orderType loop when
the chain has no reactor mapping; the cron keeps running for other
chains.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0fb5730 commit a0ca089
5 files changed
Lines changed: 14 additions & 7 deletions
File tree
- lib
- crons/gs-reaper
- handlers
- check-order-status
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
270 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| |||
0 commit comments