Skip to content

fix(init): fall back to no-platform on 400 invalid platform from registry#1036

Merged
betegon merged 2 commits into
mainfrom
fix/init-invalid-platform-fallback
May 29, 2026
Merged

fix(init): fall back to no-platform on 400 invalid platform from registry#1036
betegon merged 2 commits into
mainfrom
fix/init-invalid-platform-fallback

Conversation

@betegon
Copy link
Copy Markdown
Member

@betegon betegon commented May 29, 2026

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:

✔ Detect platform (javascript-hono)
✖ Ensure Sentry project
  WizardError: Project ensure failed: Failed to create project: 400 Bad Request
    {"platform":["Invalid platform"]}

After:

✔ Detect platform (javascript-hono)
✔ Ensure Sentry project  (project created, platform tag omitted)
◆ Select features

Changes

  • src/lib/init/tools/create-sentry-project.tswithPlatformFallback() helper wraps both the team-scoped path (createProjectWithDsn) and the 403-fallback path (createProjectWithAutoTeam); captures the exception with attemptedPlatform and apiResponseDetail for observability

Closes CLI-1WK

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

github-actions Bot commented May 29, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-05-29 15:06 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@betegon betegon marked this pull request as ready for review May 29, 2026 14:45
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Codecov Results 📊

✅ Patch coverage is 84.62%. Project has 4300 uncovered lines.
❌ Project coverage is 81.99%. Comparing base (base) to head (head).

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

Generated by Codecov Action

Comment thread src/lib/init/tools/create-sentry-project.ts
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@betegon betegon merged commit 5e68ac2 into main May 29, 2026
29 checks passed
@betegon betegon deleted the fix/init-invalid-platform-fallback branch May 29, 2026 15:14
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