Skip to content

feat(nitro): Nitro SDK#19224

Open
logaretm wants to merge 10 commits intodevelopfrom
awad/create-nitro-sdk-metadata
Open

feat(nitro): Nitro SDK#19224
logaretm wants to merge 10 commits intodevelopfrom
awad/create-nitro-sdk-metadata

Conversation

@logaretm
Copy link
Copy Markdown
Member

@logaretm logaretm commented Feb 6, 2026

This PR just isolates the mundane changes needed for a new SDK to keep the next stacked PRs clean, it adds the Nitro SDK to the monorepo.

This PR is a base of a stack, the stacked PRs will be merged into it. I thought this will be easier to review.


This PR is part of a Stack:

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 9, 2026

Codecov Results 📊


Generated by Codecov Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 9, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 10,850 - 9,029 +20%
GET With Sentry 1,689 16% 1,578 +7%
GET With Sentry (error only) 7,026 65% 5,938 +18%
POST Baseline 1,044 - 1,193 -12%
POST With Sentry 490 47% 566 -13%
POST With Sentry (error only) 915 88% 1,035 -12%
MYSQL Baseline 3,653 - 3,285 +11%
MYSQL With Sentry 360 10% 405 -11%
MYSQL With Sentry (error only) 2,881 79% 2,652 +9%

View base workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 19, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.78 kB - -
@sentry/browser - with treeshaking flags 24.27 kB - -
@sentry/browser (incl. Tracing) 42.77 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.4 kB - -
@sentry/browser (incl. Tracing, Replay) 81.69 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.22 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 86.39 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.6 kB - -
@sentry/browser (incl. Feedback) 42.59 kB - -
@sentry/browser (incl. sendFeedback) 30.45 kB - -
@sentry/browser (incl. FeedbackAsync) 35.45 kB - -
@sentry/browser (incl. Metrics) 27.07 kB - -
@sentry/browser (incl. Logs) 27.2 kB - -
@sentry/browser (incl. Metrics & Logs) 27.89 kB - -
@sentry/react 27.53 kB - -
@sentry/react (incl. Tracing) 45.09 kB - -
@sentry/vue 30.61 kB - -
@sentry/vue (incl. Tracing) 44.63 kB - -
@sentry/svelte 25.8 kB - -
CDN Bundle 28.46 kB - -
CDN Bundle (incl. Tracing) 43.82 kB - -
CDN Bundle (incl. Logs, Metrics) 29.83 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.89 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.73 kB - -
CDN Bundle (incl. Tracing, Replay) 80.78 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.83 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 86.31 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 87.34 kB - -
CDN Bundle - uncompressed 83.12 kB - -
CDN Bundle (incl. Tracing) - uncompressed 129.95 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.27 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 133.36 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 210.63 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 247.21 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 250.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 260.12 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 263.51 kB - -
@sentry/nextjs (client) 47.52 kB - -
@sentry/sveltekit (client) 43.24 kB - -
@sentry/node-core 57.94 kB +0.02% +6 B 🔺
@sentry/node 174.8 kB +0.01% +10 B 🔺
@sentry/node - without tracing 97.88 kB +0.03% +23 B 🔺
@sentry/aws-serverless 115.13 kB +0.01% +7 B 🔺

View base workflow run

@logaretm logaretm force-pushed the awad/create-nitro-sdk-metadata branch 2 times, most recently from 1317257 to 2a86160 Compare February 23, 2026 14:51
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you apply the label PR: no-auto-close I will leave it alone ... forever!

@logaretm logaretm force-pushed the awad/create-nitro-sdk-metadata branch from 99ea611 to 9ded4c9 Compare April 15, 2026 13:10
@logaretm logaretm changed the title feat(nitro): Nitro SDK entry and metadata feat(nitro): Nitro SDK Apr 15, 2026
Comment thread yarn.lock Outdated
@logaretm logaretm force-pushed the awad/create-nitro-sdk-metadata branch from 53bf486 to 5f43f63 Compare April 15, 2026 13:15
@logaretm logaretm marked this pull request as ready for review April 15, 2026 17:16
@logaretm logaretm requested review from JPeer264, Copilot and s1gr1d April 15, 2026 17:16
Copy link
Copy Markdown

@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 4 potential issues.

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 ff579f3. Configure here.

Comment thread packages/nitro/src/sdk.ts
...options,
};

applySdkMetadata(opts, 'nitro');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing 'node' in SDK metadata packages list

Medium Severity

The applySdkMetadata call passes only 'nitro', which means names defaults to ['nitro']. Every other Node-wrapping SDK in the monorepo (nestjs, nuxt, sveltekit, solidstart, astro, aws-serverless, google-cloud-serverless) passes the names array explicitly to include 'node', e.g. applySdkMetadata(opts, 'nitro', ['nitro', 'node']). Without this, the SDK telemetry metadata won't list @sentry/node as a package dependency, making the Nitro SDK inconsistent with all peer SDKs.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff579f3. Configure here.

expect(NitroServer).toBeDefined();
expect(NitroServer.init).toBeDefined();
});
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No integration or E2E test for feat PR

Low Severity

This is a feat PR but only includes a placeholder test that checks whether exports are defined. Per the review rules, feat PRs are expected to include at least one integration or E2E test. While the PR description notes stacked PRs will follow, it would be good to add meaningful tests — for example verifying that init correctly sets SDK metadata or that withSentryConfig properly adds the Sentry module to the Nitro config.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit ff579f3. Configure here.

"build/types/plugins.d.ts"
]
}
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead typesVersions entry references non-existent plugins path

Low Severity

The typesVersions field maps "plugins" to build/types/plugins.d.ts, but no src/plugins.ts source file exists in the package, and there's no corresponding ./plugins entry in the exports field. This is a copy-paste artifact from another package template. It advertises a non-existent subpath to TypeScript, which could confuse consumers trying to import @sentry/nitro/plugins.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff579f3. Configure here.

},

"//": "This is built separately in tsconfig.setup-types.json",
"exclude": ["src/setup.ts"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy-pasted tsconfig excludes non-existent setup files

Low Severity

The tsconfig.types.json excludes src/setup.ts and references a tsconfig.setup-types.json — neither of which exist in this package. This was copied from the NestJS package (which actually has both files). While functionally harmless, it's misleading scaffolding that suggests missing build infrastructure.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff579f3. Configure here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new @sentry/nitro package skeleton to the monorepo and wires it into the repo’s release/testing/triage infrastructure as the base for a stacked series of Nitro SDK PRs.

Changes:

  • Introduces the new packages/nitro package with initial SDK/config scaffolding, build config, and a placeholder test.
  • Registers the package across monorepo plumbing (workspace list, root README, issue templates/labeling, release config).
  • Updates lockfile for the newly introduced dependency graph.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
yarn.lock Lockfile updates due to dependency graph changes.
packages/nitro/package.json New package manifest, exports, build/test scripts.
packages/nitro/rollup.npm.config.mjs Rollup config for publishing builds (ESM-only).
packages/nitro/tsconfig.json Package TS config (module/moduleResolution overrides).
packages/nitro/tsconfig.types.json Declaration-only build config for emitted types.
packages/nitro/tsconfig.test.json Test TS config for package tests.
packages/nitro/src/index.ts Public entrypoint re-exporting config + @sentry/node + Nitro init.
packages/nitro/src/sdk.ts Nitro SDK initialization wrapper around @sentry/node.
packages/nitro/src/config.ts withSentryConfig / module setup helper for Nitro config.
packages/nitro/src/module.ts Nitro module factory placeholder.
packages/nitro/src/common/debug-build.ts Debug-build flag constant (pattern consistent with other packages).
packages/nitro/src/utils/resolver.ts Path resolver helper utility.
packages/nitro/src/utils/plugin.ts Helper to add Nitro plugins.
packages/nitro/test/index.test.ts Placeholder Vitest test.
packages/nitro/test/tsconfig.json Test tsconfig shim extending package test config.
packages/nitro/README.md Initial package documentation.
packages/nitro/LICENSE Package license file.
packages/nitro/.eslintrc.js Package-local ESLint config extending repo base.
package.json Adds packages/nitro to workspace list.
dev-packages/e2e-tests/verdaccio-config/config.yaml Allows publishing @sentry/nitro in Verdaccio E2E setup.
README.md Adds @sentry/nitro to root package list.
.github/workflows/issue-package-label.yml Adds Nitro to package-to-label mapping.
.github/ISSUE_TEMPLATE/bug.yml Adds @sentry/nitro to bug template SDK dropdown.
.craft.yml Adds Nitro package to Craft release targets/metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/nitro/src/sdk.ts
*
* @returns The default integrations for the Nitro SDK.
*/
export function getDefaultIntegrations(options: NodeOptions): Integration[] | undefined {
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

getDefaultIntegrations is declared to return Integration[] | undefined, but it always returns an array. Returning Integration[] avoids unnecessary undefined handling for callers and matches @sentry/node’s getDefaultIntegrations shape.

Suggested change
export function getDefaultIntegrations(options: NodeOptions): Integration[] | undefined {
export function getDefaultIntegrations(options: NodeOptions): Integration[] {

Copilot uses AI. Check for mistakes.
Comment thread packages/nitro/src/sdk.ts
Comment on lines +9 to +13
export function init(options: NodeOptions | undefined = {}): NodeClient | undefined {
const opts: NodeOptions = {
defaultIntegrations: getDefaultIntegrations(options),
...options,
};
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

options is typed as NodeOptions | undefined, but getDefaultIntegrations currently requires NodeOptions, so this call won’t type-check under strict TS. Either change init to take options: NodeOptions = {} or pass options ?? {} and update getDefaultIntegrations accordingly (and keep the types aligned with @sentry/node).

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +24
"typesVersions": {
"*": {
"plugins": [
"build/types/plugins.d.ts"
]
}
},
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

typesVersions adds a plugins subpath mapped to build/types/plugins.d.ts, but this PR doesn’t add any source that would emit that declaration file. This leaves a dangling mapping and will break TS resolution for @sentry/nitro/plugins.

Suggested change
"typesVersions": {
"*": {
"plugins": [
"build/types/plugins.d.ts"
]
}
},

Copilot uses AI. Check for mistakes.
Comment thread packages/nitro/README.md
Comment on lines +111 to +123
## Uploading Source Maps

The `withSentryConfig` function automatically configures source map uploading when the `authToken`, `org`, and `project`
options are provided:

```javascript
export default withSentryConfig(config, {
org: 'your-sentry-org',
project: 'your-sentry-project',
authToken: process.env.SENTRY_AUTH_TOKEN,
});
```

Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

This section claims withSentryConfig automatically configures source map uploading when authToken/org/project are provided, but that functionality (and option typings) isn’t implemented in this PR. As-is, the docs are misleading; consider removing this section for now or clearly marking it as upcoming work in the stacked PRs.

Suggested change
## Uploading Source Maps
The `withSentryConfig` function automatically configures source map uploading when the `authToken`, `org`, and `project`
options are provided:
```javascript
export default withSentryConfig(config, {
org: 'your-sentry-org',
project: 'your-sentry-project',
authToken: process.env.SENTRY_AUTH_TOKEN,
});
```

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +12
* Modifies the passed in Nitro configuration with automatic build-time instrumentation.
*
* @param config A Nitro configuration object, as usually exported in `nitro.config.ts` or `nitro.config.mjs`.
* @returns The modified config to be exported
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The docstring mentions “automatic build-time instrumentation”, but the current implementation only appends a (currently no-op) module and doesn’t use moduleOptions. Please adjust the wording to match the current behavior (or implement the described instrumentation in this PR).

Suggested change
* Modifies the passed in Nitro configuration with automatic build-time instrumentation.
*
* @param config A Nitro configuration object, as usually exported in `nitro.config.ts` or `nitro.config.mjs`.
* @returns The modified config to be exported
* Modifies the passed in Nitro configuration by registering the Sentry Nitro module.
*
* @param config A Nitro configuration object, as usually exported in `nitro.config.ts` or `nitro.config.mjs`.
* @returns The modified config to be exported with the Sentry Nitro module registered

Copilot uses AI. Check for mistakes.
Comment thread packages/nitro/README.md

## Compatibility

The minimum supported version of Nitro is `3.0.0-alpha.1`.
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The README states the minimum supported Nitro version is 3.0.0-alpha.1, but peerDependencies requires nitro >=3.0.260311-beta. Please align the README with the actual supported range (or adjust the peer dependency) to avoid confusing users.

Suggested change
The minimum supported version of Nitro is `3.0.0-alpha.1`.
The minimum supported version of Nitro is `3.0.260311-beta`.

Copilot uses AI. Check for mistakes.
import { createNitroModule } from './module';

type SentryNitroOptions = {
// TODO: Add options
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

SentryNitroOptions is an empty object type, which means the README examples passing { org, project, authToken } will fail TS excess-property checks, and callers can’t actually configure anything yet. Consider defining the intended option shape (even if partial) or using a permissive placeholder type (e.g. Record<string, unknown>) until the real options land.

Suggested change
// TODO: Add options
org?: string;
project?: string;
authToken?: string;
[key: string]: unknown;

Copilot uses AI. Check for mistakes.
"outDir": "build/types"
},

"//": "This is built separately in tsconfig.setup-types.json",
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

This comment references tsconfig.setup-types.json, but that file doesn’t exist in this package (and the scripts only run tsconfig.types.json). Consider either adding the referenced config (if needed) or updating/removing the comment to avoid confusion for future maintainers.

Suggested change
"//": "This is built separately in tsconfig.setup-types.json",
"//": "Exclude setup entrypoint from this declaration-only build",

Copilot uses AI. Check for mistakes.
import * as NitroServer from '../src';

describe('Nitro SDK', () => {
// This is a place holder test at best to satisfy the test runner
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

Spelling/wording: “place holder” should be “placeholder”, and the comment sentence could be tightened up. Since this is a user-facing test file, it’s worth correcting for clarity.

Suggested change
// This is a place holder test at best to satisfy the test runner
// Placeholder test to satisfy the test runner

Copilot uses AI. Check for mistakes.
Comment thread packages/nitro/src/sdk.ts
...options,
};

applySdkMetadata(opts, 'nitro');
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

For wrapper SDKs around @sentry/node, we typically include both the wrapper and node package names in applySdkMetadata so events show the full package chain (e.g. Remix uses ['remix', 'node']). Consider using applySdkMetadata(opts, 'nitro', ['nitro', 'node']) for consistency.

Suggested change
applySdkMetadata(opts, 'nitro');
applySdkMetadata(opts, 'nitro', ['nitro', 'node']);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants