Commit 3c370fe
authored
fix(dashboard): normalize numeric org IDs from DSN auto-detection (#593)
## Summary
- Fixes `dashboard list` and `dashboard view` failing with 404/403 when
org is auto-detected from a DSN and the project cache is cold
- Adds `normalizeNumericOrg()` to `resolveOrg()` that converts bare
numeric org IDs to slugs via DB cache or `listOrganizationsUncached` API
fallback
- Normalizes explicit org args in `resolveOrgFromTarget` via
`resolveEffectiveOrg` to handle `o`-prefixed DSN forms
## Root Cause
`resolveOrgFromDsn()` returns the raw numeric org ID from the DSN host
(e.g., `"1169445"` from `o1169445.ingest.us.sentry.io`) when the project
cache is cold. Dashboard API endpoints reject numeric IDs. Meanwhile,
`dashboard create` works because it uses `resolveAllTargets` which does
a full project API lookup.
`resolveEffectiveOrg()` cannot be reused directly because it only
handles `o`-prefixed DSN forms — the DSN parser strips the `o` prefix
before `resolveOrgFromDsn` returns.
## Changes
| File | Change |
|------|--------|
| `src/lib/resolve-target.ts` | Add `normalizeNumericOrg()` helper,
update `resolveOrg()` DSN path |
| `src/commands/dashboard/resolve.ts` | Normalize explicit/org-all org
via `resolveEffectiveOrg` |
| `test/isolated/resolve-target.test.ts` | Tests for cache hit, API
fallback, and slug passthrough |
| `test/commands/dashboard/resolve.test.ts` | Tests for
`resolveEffectiveOrg` integration |
Closes #4471 parent f57249b commit 3c370fe
File tree
5 files changed
+211
-5
lines changed- src
- commands/dashboard
- lib
- test
- commands/dashboard
- isolated
5 files changed
+211
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
908 | 911 | | |
909 | 912 | | |
910 | 913 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
254 | 297 | | |
255 | 298 | | |
256 | 299 | | |
| |||
1019 | 1062 | | |
1020 | 1063 | | |
1021 | 1064 | | |
1022 | | - | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1023 | 1071 | | |
1024 | 1072 | | |
1025 | 1073 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
333 | 335 | | |
334 | 336 | | |
335 | 337 | | |
| 338 | + | |
336 | 339 | | |
337 | 340 | | |
338 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
339 | 347 | | |
340 | 348 | | |
341 | 349 | | |
342 | 350 | | |
| 351 | + | |
343 | 352 | | |
344 | 353 | | |
345 | | - | |
| 354 | + | |
346 | 355 | | |
347 | 356 | | |
348 | 357 | | |
349 | 358 | | |
350 | 359 | | |
351 | 360 | | |
352 | 361 | | |
| 362 | + | |
353 | 363 | | |
354 | 364 | | |
355 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
356 | 378 | | |
357 | 379 | | |
358 | 380 | | |
| |||
361 | 383 | | |
362 | 384 | | |
363 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
364 | 398 | | |
365 | 399 | | |
366 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
94 | 125 | | |
95 | 126 | | |
96 | 127 | | |
97 | 128 | | |
| 129 | + | |
98 | 130 | | |
99 | 131 | | |
100 | 132 | | |
| |||
124 | 156 | | |
125 | 157 | | |
126 | 158 | | |
| 159 | + | |
| 160 | + | |
127 | 161 | | |
128 | 162 | | |
129 | 163 | | |
| |||
146 | 180 | | |
147 | 181 | | |
148 | 182 | | |
| 183 | + | |
| 184 | + | |
149 | 185 | | |
150 | 186 | | |
151 | 187 | | |
| |||
223 | 259 | | |
224 | 260 | | |
225 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
226 | 344 | | |
227 | 345 | | |
228 | 346 | | |
| |||
0 commit comments