fix(init): retry project creation without platform when API rejects slug#939
Closed
fix(init): retry project creation without platform when API rejects slug#939
Conversation
Some SDK keys (e.g. sentry.javascript.hono) produce platform IDs via
the naive transform that the Sentry project creation API doesn't
recognize. When the API returns 400 {"platform":["Invalid platform"]},
retry once without the platform field. The platform label is cosmetic —
the wizard installs the correct SDK and generates the right code from
the detected SDK key regardless of the project's platform tag.
Fixes CLI-SERVER-E.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Contributor
Codecov Results 📊✅ 6837 passed | Total: 6837 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 76.19%. Project has 13927 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 77.03% 77.03% —%
==========================================
Files 317 317 —
Lines 60609 60620 +11
Branches 0 0 —
==========================================
+ Hits 46684 46693 +9
- Misses 13925 13927 +2
- Partials 0 0 —Generated by Codecov Action |
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.
When
sentry initdetects a framework whose SDK key produces a platform slug the Sentry API doesn't recognize (e.g.sentry.javascript.hono→javascript-hono), the project creation call returns400 {"platform":["Invalid platform"]}and the wizard bails.The platform field on a Sentry project is cosmetic — the wizard uses the SDK key all the way through for docs fetching, codemod planning, and package installation, so the project's platform tag has no effect on the actual integration. If the API rejects the platform slug, we now retry once without it. The project is created, the DSN comes back, and the wizard continues normally.
Fixes CLI-SERVER-E.
Testing
bun test test/lib/init/tools/create-sentry-project.test.ts— 9 tests pass (1 new: retries without platform on 400).