Skip to content

fix(init): retry project creation without platform when API rejects slug#939

Closed
betegon wants to merge 1 commit intomainfrom
fix/init-invalid-platform-fallback
Closed

fix(init): retry project creation without platform when API rejects slug#939
betegon wants to merge 1 commit intomainfrom
fix/init-invalid-platform-fallback

Conversation

@betegon
Copy link
Copy Markdown
Member

@betegon betegon commented May 8, 2026

When sentry init detects a framework whose SDK key produces a platform slug the Sentry API doesn't recognize (e.g. sentry.javascript.honojavascript-hono), the project creation call returns 400 {"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).

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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-939/

Built to branch gh-pages at 2026-05-08 18:17 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@betegon betegon closed this May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Codecov Results 📊

6837 passed | Total: 6837 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +1
Passed Tests 📈 +1
Failed Tests
Skipped Tests

All tests are passing successfully.

❌ Patch coverage is 76.19%. Project has 13927 uncovered lines.
✅ Project coverage is 77.03%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/init/tools/create-sentry-project.ts 76.19% ⚠️ 5 Missing
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant