Skip to content

feat(onboarding): Update Hono onboarding with @sentry/hono#115476

Open
s1gr1d wants to merge 3 commits into
masterfrom
sig/hono-onboarding-update
Open

feat(onboarding): Update Hono onboarding with @sentry/hono#115476
s1gr1d wants to merge 3 commits into
masterfrom
sig/hono-onboarding-update

Conversation

@s1gr1d
Copy link
Copy Markdown
Member

@s1gr1d s1gr1d commented May 13, 2026

Updates the Hono onboarding guide to use the new dedicated @sentry/hono SDK which supports multiple runtimes (Cloudflare Workers, Node.js, and Bun).

  • Replaces the generic Node.js-only onboarding with runtime-specific installation and configuration steps
  • Adds a runtime selector (platformOptions) so users can switch between Cloudflare Workers, Node.js, and Bun instructions
  • Adds an informational alert when profiling is selected on non-Node.js runtimes (profiling is only supported on Node.js)
  • Adds an importPath option to shared onboarding utilities (logs, metrics, mcp) so Hono can use a different path for import statements (@sentry/hono/node) than for install commands (@sentry/hono)

closes getsentry/sentry-javascript#20817


image

@s1gr1d s1gr1d requested a review from a team as a code owner May 13, 2026 12:57
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 13, 2026
@s1gr1d s1gr1d requested review from priscilawebdev and sergical May 13, 2026 12:59
Comment thread static/app/gettingStartedDocs/node/utils.tsx
export const logs = getNodeLogsOnboarding({
docsPlatform: 'hono',
packageName: '@sentry/node',
packageName: '@sentry/hono',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Hono onboarding configuration for logs, metrics, and MCP uses a static placeholder importPath of '@sentry/hono/<your-runtime>', resulting in invalid import statements in generated code snippets.
Severity: HIGH

Suggested Fix

Update the code generation logic to dynamically substitute the <your-runtime> placeholder within the importPath string with the actual runtime value selected by the user during the onboarding flow.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/gettingStartedDocs/node-hono/logs.tsx#L5

Potential issue: The onboarding configurations for Hono logs, metrics, and performance
monitoring use a static placeholder string `'@sentry/hono/<your-runtime>'` for the
`importPath`. This placeholder is directly embedded into the generated code snippets
shown to the user without being substituted with the actual selected runtime (e.g.,
`node`, `cloudflare`). This results in an invalid import statement like `import * as
Sentry from "@sentry/hono/<your-runtime>";`, which will cause the user's application to
fail.

Also affects:

  • static/app/gettingStartedDocs/node-hono/mcp.tsx:4~4
  • static/app/gettingStartedDocs/node-hono/metrics.tsx:5~5

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on purpose, there is no neat way to do this currently without refactoring this. It's better to include < your runtime > than have a wrong @sentry/hono/node import (when using e.g. Cloudflare) as it's harder to catch the problem.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.51% 93.51% ±0%
Typed 135,395 135,424 🟢 +29
Untyped 9,403 9,405 🔴 +2
🔍 2 new type safety issues introduced

Type assertions (as) (2 new)

File Line Detail
static/app/gettingStartedDocs/node/utils.tsx 322 as @sentry/${string} — `(importPath ?? packageName) as `@sentry/${string}
static/app/gettingStartedDocs/node/utils.tsx 533 as @sentry/${string} — `importFrom as `@sentry/${string}

This is informational only and does not block the PR.

Comment thread static/app/gettingStartedDocs/node-hono/onboarding.tsx Outdated
Comment thread static/app/gettingStartedDocs/node-hono/profiling.tsx
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d84b555. Configure here.

Comment thread static/app/gettingStartedDocs/node-hono/onboarding.tsx
Comment on lines +3 to +6
export const mcp = getNodeMcpOnboarding({
packageName: '@sentry/hono',
importPath: '@sentry/hono/<your-runtime>',
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Hono onboarding for logs, mcp, and metrics generates code snippets with an invalid, placeholder import path @sentry/hono/<your-runtime>, which will cause an error for users.
Severity: HIGH

Suggested Fix

The onboarding configuration objects for logs, mcp, and metrics should be generated dynamically at render time, rather than being static constants. This would allow them to access the params object, which contains the user-selected platformOptions.runtime, and construct a valid, runtime-specific import path. This would align their behavior with the main onboarding.tsx file.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/gettingStartedDocs/node-hono/mcp.tsx#L3-L6

Potential issue: The Hono onboarding configurations for `logs`, `mcp`, and `metrics` are
created at module load time with a static, placeholder `importPath` value of
`'@sentry/hono/<your-runtime>'`. The utility functions that consume this path, such as
`getNodeMcpOnboarding`, use it verbatim to generate code snippets for the user. This
results in an invalid import statement, `import * as Sentry from
"@sentry/hono/<your-runtime>";`, being displayed in the setup documentation. Because the
configuration is static, there is no opportunity to substitute the `<your-runtime>`
placeholder with the actual runtime selected by the user, leading to code that will fail
with a module not found error when copied.

Also affects:

  • static/app/gettingStartedDocs/node-hono/metrics.tsx:3~6

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Hono Product Onboarding

1 participant