fix(init): fall back to no-platform on 400 invalid platform from registry#1036
Merged
Conversation
…stry
The Sentry release registry added new JS SDK entries (sentry.javascript.hono,
elysia, nitro, effect, etc.) on May 28 as part of the 10.55.0 release. The
platform-matcher agent now returns these keys for matching frameworks, but the
Sentry project-creation API doesn't yet accept the derived platform slugs
(e.g. "javascript-hono"), returning 400 {"platform":["Invalid platform"]}.
When that happens, retry project creation without the platform field so the
project is still created and the wizard continues. Capture the exception in
Sentry so we can track which slugs need to be added to the API allowlist.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 84.62%. Project has 4300 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 82.00% 81.99% -0.01%
==========================================
Files 329 329 —
Lines 23806 23879 +73
Branches 15543 15601 +58
==========================================
+ Hits 19522 19579 +57
- Misses 4284 4300 +16
- Partials 1643 1650 +7Generated by Codecov Action |
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Sentry release registry added new JS SDK entries (sentry.javascript.hono, elysia, nitro, effect, tanstackstart-react, react-router, vercel-edge, node-core) as part of the 10.55.0 release. The platform-matcher agent now returns these keys for matching frameworks. `getSentryPlatform()` derives slugs like `javascript-hono` from them, but the Sentry project-creation API doesn't yet accept those slugs — returning `400 {"platform":["Invalid platform"]}` and crashing the wizard before the feature selector is shown.
The in-memory registry cache resets on every Worker restart, so there's nothing to clear — any fix has to be in code.
Solution
When `createProjectWithDsn` or `createProjectWithAutoTeam` returns `400` with `"Invalid platform"` in the detail, retry the same call without the `platform` field. The project is still created; the platform tag is cosmetic and doesn't affect which SDK the codemod planner installs. Capture the exception in Sentry so we can track which slugs need to be added to the API's valid platform list.
Before:
After:
Changes
src/lib/init/tools/create-sentry-project.ts—withPlatformFallback()helper wraps both the team-scoped path (createProjectWithDsn) and the 403-fallback path (createProjectWithAutoTeam); captures the exception withattemptedPlatformandapiResponseDetailfor observabilityCloses CLI-1WK