Skip to content

Commit f923096

Browse files
authored
Merge branch 'develop' into billy/replay-437-buffered-replays-are-being-captured-with-no-linked-errors
2 parents 5b50623 + aa52d6c commit f923096

File tree

569 files changed

+10013
-13535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

569 files changed

+10013
-13535
lines changed

.craft.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,13 @@ targets:
146146
# AWS Lambda Layer target
147147
- name: aws-lambda-layer
148148
includeNames: /^sentry-node-serverless-\d+.\d+.\d+(-(beta|alpha|rc)\.\d+)?\.zip$/
149-
layerName: SentryNodeServerlessSDKv9
149+
layerName: SentryNodeServerlessSDKv10
150150
compatibleRuntimes:
151151
- name: node
152152
versions:
153-
- nodejs10.x
154-
- nodejs12.x
155-
- nodejs14.x
156-
- nodejs16.x
157153
- nodejs18.x
158154
- nodejs20.x
155+
- nodejs22.x
159156
license: MIT
160157

161158
# CDN Bundle Target

.cursor/environment.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Sentry JavaScript SDK Development",
3+
"install": "curl https://get.volta.sh | bash && export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && yarn install",
4+
"start": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1",
5+
"terminals": [
6+
{
7+
"name": "Development",
8+
"command": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && echo 'Volta setup complete. Node version:' && node --version && echo 'Yarn version:' && yarn --version",
9+
"description": "Main development terminal with Volta environment configured"
10+
}
11+
]
12+
}

.cursor/rules/sdk_dependency_upgrades.mdc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Use this rule if you are looking to upgrade a dependency in the Sen
33
globs:
44
alwaysApply: false
55
---
6+
67
# Yarn v1 Dependency Upgrades
78

89
## Upgrade Process
@@ -45,10 +46,12 @@ Avoid upgrading top-level dependencies (defined in `package.json`), especially i
4546
**STOP UPGRADE IMMEDIATELY** if upgrading any dependency with `opentelemetry` in the name and the new version or any of its dependencies uses forbidden OpenTelemetry versions.
4647

4748
**FORBIDDEN VERSION PATTERNS:**
49+
4850
- `2.x.x` versions (e.g., `2.0.0`, `2.1.0`)
4951
- `0.2xx.x` versions (e.g., `0.200.0`, `0.201.0`)
5052

5153
When upgrading OpenTelemetry dependencies:
54+
5255
1. Check the dependency's `package.json` after upgrade
5356
2. Verify the package itself doesn't use forbidden version patterns
5457
3. Verify none of its dependencies use `@opentelemetry/*` packages with forbidden version patterns
@@ -153,6 +156,7 @@ yarn info <package-name> versions
153156
```
154157

155158
The `yarn info` command provides detailed dependency information without requiring installation, making it particularly useful for:
159+
156160
- Verifying OpenTelemetry packages don't introduce forbidden version patterns (`2.x.x` or `0.2xx.x`)
157161
- Checking what dependencies a package will bring in before upgrading
158162
- Understanding package version history and compatibility

.cursor/rules/sdk_development.mdc

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
1212
**CRITICAL**: All changes must pass these checks before committing:
1313

1414
1. **Always run `yarn lint`** - Fix all linting issues
15-
2. **Always run `yarn test`** - Ensure all tests pass
15+
2. **Always run `yarn test`** - Ensure all tests pass
1616
3. **Always run `yarn build:dev`** - Verify TypeScript compilation
1717

1818
## Development Commands
1919

2020
### Build Commands
21+
2122
- `yarn build` - Full production build with package verification
2223
- `yarn build:dev` - Development build (transpile + types)
2324
- `yarn build:dev:watch` - Development build in watch mode (recommended)
@@ -26,13 +27,11 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
2627
- `yarn build:bundle` - Build browser bundles only
2728

2829
### Testing
29-
- `yarn test` - Run all tests (excludes integration tests)
30-
- `yarn test:unit` - Run unit tests only
31-
- `yarn test:pr` - Run tests affected by changes (CI mode)
32-
- `yarn test:pr:browser` - Run affected browser-specific tests
33-
- `yarn test:pr:node` - Run affected Node.js-specific tests
30+
31+
- `yarn test` - Run all unit tests
3432

3533
### Linting and Formatting
34+
3635
- `yarn lint` - Run ESLint and Prettier checks
3736
- `yarn fix` - Auto-fix linting and formatting issues
3837
- `yarn lint:es-compatibility` - Check ES compatibility
@@ -42,12 +41,17 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
4241
This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for details.
4342

4443
### Key Rules
44+
4545
- **All PRs target `develop` branch** (NOT `master`)
4646
- `master` represents the last released state
4747
- Never merge directly into `master` (except emergency fixes)
4848
- Avoid changing `package.json` files on `develop` during pending releases
49+
- Never update dependencies, package.json content or build scripts unless explicitly asked for
50+
- When asked to do a task on a set of files, always make sure that all occurences in the codebase are covered. Double check that no files have been forgotten.
51+
- Unless explicitly asked for, make sure to cover all files, including files in `src/` and `test/` directories.
4952

5053
### Branch Naming
54+
5155
- Features: `feat/descriptive-name`
5256
- Releases: `release/X.Y.Z`
5357

@@ -56,27 +60,33 @@ This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for de
5660
This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace.
5761

5862
### Core Packages
63+
5964
- `packages/core/` - Base SDK with interfaces, type definitions, core functionality
60-
- `packages/types/` - Shared TypeScript type definitions (active)
65+
- `packages/types/` - Shared TypeScript type definitions - this is deprecated, never modify this package
6166
- `packages/browser-utils/` - Browser-specific utilities and instrumentation
67+
- `packages/node-core/` - Node Core SDK which contains most of the node-specific logic, excluding OpenTelemetry instrumentation.
6268

6369
### Platform SDKs
70+
6471
- `packages/browser/` - Browser SDK with bundled variants
65-
- `packages/node/` - Node.js SDK with server-side integrations
72+
- `packages/node/` - Node.js SDK. All general Node code should go into node-core, the node package itself only contains OpenTelemetry instrumentation on top of that.
6673
- `packages/bun/`, `packages/deno/`, `packages/cloudflare/` - Runtime-specific SDKs
6774

6875
### Framework Integrations
76+
6977
- Framework packages: `packages/{framework}/` (react, vue, angular, etc.)
7078
- Client/server entry points where applicable (nextjs, nuxt, sveltekit)
7179
- Integration tests use Playwright (Remix, browser-integration-tests)
7280

7381
### User Experience Packages
82+
7483
- `packages/replay-internal/` - Session replay functionality
7584
- `packages/replay-canvas/` - Canvas recording for replay
7685
- `packages/replay-worker/` - Web worker support for replay
7786
- `packages/feedback/` - User feedback integration
7887

7988
### Development Packages (`dev-packages/`)
89+
8090
- `browser-integration-tests/` - Playwright browser tests
8191
- `e2e-tests/` - End-to-end tests for 70+ framework combinations
8292
- `node-integration-tests/` - Node.js integration tests
@@ -88,41 +98,55 @@ This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace.
8898
## Development Guidelines
8999

90100
### Build System
101+
91102
- Uses Rollup for bundling (`rollup.*.config.mjs`)
92103
- TypeScript with multiple tsconfig files per package
93104
- Lerna manages package dependencies and publishing
94105
- Vite for testing with `vitest`
95106

96107
### Package Structure Pattern
108+
97109
Each package typically contains:
110+
98111
- `src/index.ts` - Main entry point
99112
- `src/sdk.ts` - SDK initialization logic
100113
- `rollup.npm.config.mjs` - Build configuration
101114
- `tsconfig.json`, `tsconfig.test.json`, `tsconfig.types.json`
102115
- `test/` directory with corresponding test files
103116

104117
### Key Development Notes
118+
105119
- Uses Volta for Node.js/Yarn version management
106120
- Requires initial `yarn build` after `yarn install` for TypeScript linking
107121
- Integration tests use Playwright extensively
108-
- Native profiling requires Python <3.12 for binary builds
122+
- Never change the volta, yarn, or package manager setup in general unless explicitly asked for
123+
124+
### Notes for Background Tasks
125+
126+
- Make sure to use [volta](https://volta.sh/) for development. Volta is used to manage the node, yarn and pnpm version used.
127+
- Make sure that [PNPM support is enabled in volta](https://docs.volta.sh/advanced/pnpm). This means that the `VOLTA_FEATURE_PNPM` environment variable has to be set to `1`.
128+
- Yarn, Node and PNPM have to be used through volta, in the versions defined by the volta config. NEVER change any versions unless explicitly asked to.
109129

110130
## Testing Single Packages
131+
111132
- Test specific package: `cd packages/{package-name} && yarn test`
112133
- Build specific package: `yarn build:dev:filter @sentry/{package-name}`
113134

114135
## Code Style Rules
136+
115137
- Follow existing code conventions in each package
116138
- Check imports and dependencies - only use libraries already in the codebase
117139
- Look at neighboring files for patterns and style
118140
- Never introduce code that exposes secrets or keys
119141
- Follow security best practices
120142

121143
## Before Every Commit Checklist
144+
122145
1. ✅ `yarn lint` (fix all issues)
123146
2. ✅ `yarn test` (all tests pass)
124147
3. ✅ `yarn build:dev` (builds successfully)
125148
4. ✅ Target `develop` branch for PRs (not `master`)
126149

127150
## Documentation Sync
128-
**IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync.
151+
152+
**IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync.

.github/workflows/build.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ env:
4747
${{ github.workspace }}/packages/*/lib
4848
${{ github.workspace }}/packages/ember/*.d.ts
4949
${{ github.workspace }}/packages/gatsby/*.d.ts
50-
${{ github.workspace }}/packages/utils/cjs
51-
${{ github.workspace }}/packages/utils/esm
5250
5351
BUILD_CACHE_TARBALL_KEY: tarball-${{ github.event.inputs.commit || github.sha }}
5452

@@ -950,13 +948,13 @@ jobs:
950948
retention-days: 7
951949

952950
- name: Pre-process E2E Test Dumps
953-
if: always()
951+
if: failure()
954952
run: |
955953
node ./scripts/normalize-e2e-test-dump-transaction-events.js
956954
957955
- name: Upload E2E Test Event Dumps
958956
uses: actions/upload-artifact@v4
959-
if: always()
957+
if: failure()
960958
with:
961959
name: E2E Test Dump (${{ matrix.label || matrix.test-application }})
962960
path: ${{ runner.temp }}/test-application/event-dumps
@@ -1062,13 +1060,13 @@ jobs:
10621060
run: pnpm ${{ matrix.assert-command || 'test:assert' }}
10631061

10641062
- name: Pre-process E2E Test Dumps
1065-
if: always()
1063+
if: failure()
10661064
run: |
10671065
node ./scripts/normalize-e2e-test-dump-transaction-events.js
10681066
10691067
- name: Upload E2E Test Event Dumps
10701068
uses: actions/upload-artifact@v4
1071-
if: always()
1069+
if: failure()
10721070
with:
10731071
name: E2E Test Dump (${{ matrix.label || matrix.test-application }})
10741072
path: ${{ runner.temp }}/test-application/event-dumps

.size-limit.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,23 @@ module.exports = [
217217
gzip: true,
218218
limit: '41 KB',
219219
},
220+
// Node-Core SDK (ESM)
221+
{
222+
name: '@sentry/node-core',
223+
path: 'packages/node-core/build/esm/index.js',
224+
import: createImport('init'),
225+
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
226+
gzip: true,
227+
limit: '116 KB',
228+
},
220229
// Node SDK (ESM)
221230
{
222231
name: '@sentry/node',
223232
path: 'packages/node/build/esm/index.js',
224233
import: createImport('init'),
225234
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
226235
gzip: true,
227-
limit: '170 KB',
236+
limit: '146 KB',
228237
},
229238
{
230239
name: '@sentry/node - without tracing',

CHANGELOG.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,111 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
Work in this release was contributed by @richardjelinek-fastest. Thank you for your contribution!
8+
9+
## 9.40.0
10+
11+
### Important Changes
12+
13+
- **feat(browser): Add debugId sync APIs between web worker and main thread ([#16981](https://github.com/getsentry/sentry-javascript/pull/16981))**
14+
15+
This release adds two Browser SDK APIs to let the main thread know about debugIds of worker files:
16+
17+
- `webWorkerIntegration({worker})` to be used in the main thread
18+
- `registerWebWorker({self})` to be used in the web worker
19+
20+
```js
21+
// main.js
22+
Sentry.init({...})
23+
24+
const worker = new MyWorker(...);
25+
26+
Sentry.addIntegration(Sentry.webWorkerIntegration({ worker }));
27+
28+
worker.addEventListener('message', e => {...});
29+
```
30+
31+
```js
32+
// worker.js
33+
Sentry.registerWebWorker({ self });
34+
35+
self.postMessage(...);
36+
```
37+
38+
- **feat(core): Deprecate logger in favor of debug ([#17040](https://github.com/getsentry/sentry-javascript/pull/17040))**
39+
40+
The internal SDK `logger` export from `@sentry/core` has been deprecated in favor of the `debug` export. `debug` only exposes `log`, `warn`, and `error` methods but is otherwise identical to `logger`. Note that this deprecation does not affect the `logger` export from other packages (like `@sentry/browser` or `@sentry/node`) which is used for Sentry Logging.
41+
42+
```js
43+
import { logger, debug } from '@sentry/core';
44+
45+
// before
46+
logger.info('This is an info message');
47+
48+
// after
49+
debug.log('This is an info message');
50+
```
51+
52+
- **feat(node): Add OpenAI integration ([#17022](https://github.com/getsentry/sentry-javascript/pull/17022))**
53+
54+
This release adds official support for instrumenting OpenAI SDK calls in with Sentry tracing, following OpenTelemetry semantic conventions for Generative AI. It instruments:
55+
56+
- `client.chat.completions.create()` - For chat-based completions
57+
- `client.responses.create()` - For the responses API
58+
59+
```js
60+
// The integration respects your `sendDefaultPii` option, but you can override the behavior in the integration options
61+
62+
Sentry.init({
63+
dsn: '__DSN__',
64+
integrations: [
65+
Sentry.openAIIntegration({
66+
recordInputs: true, // Force recording prompts
67+
recordOutputs: true, // Force recording responses
68+
}),
69+
],
70+
});
71+
```
72+
73+
### Other Changes
74+
75+
- feat(node-core): Expand `@opentelemetry/instrumentation` range to cover `0.203.0` ([#17043](https://github.com/getsentry/sentry-javascript/pull/17043))
76+
- fix(cloudflare): Ensure errors get captured from durable objects ([#16838](https://github.com/getsentry/sentry-javascript/pull/16838))
77+
- fix(sveltekit): Ensure server errors from streamed responses are sent ([#17044](https://github.com/getsentry/sentry-javascript/pull/17044))
78+
79+
Work in this release was contributed by @0xbad0c0d3 and @tommy-gilligan. Thank you for your contributions!
80+
81+
## 9.39.0
82+
83+
### Important Changes
84+
85+
- **feat(browser): Add `afterStartPageloadSpan` hook to improve spanId assignment on web vital spans ([#16893](https://github.com/getsentry/sentry-javascript/pull/16893))**
86+
87+
This PR adds a new afterStartPageloadSpan lifecycle hook to more robustly assign the correct pageload span ID to web vital spans, replacing the previous unreliable "wait for a tick" approach with a direct callback that fires when the pageload span becomes available.
88+
89+
- **feat(nextjs): Client-side parameterized routes ([#16934](https://github.com/getsentry/sentry-javascript/pull/16934))**
90+
91+
This PR implements client-side parameterized routes for Next.js by leveraging an injected manifest within the existing app-router instrumentation to automatically parameterize all client-side transactions (e.g. `users/123` and `users/456` now become become `users/:id`).
92+
93+
- **feat(node): Drop 401-404 and 3xx status code spans by default ([#16972](https://github.com/getsentry/sentry-javascript/pull/16972))**
94+
95+
This PR changes the default behavior in the Node SDK to drop HTTP spans with 401-404 and 3xx status codes by default to reduce noise in tracing data.
96+
97+
### Other Changes
98+
99+
- feat(core): Prepend vercel ai attributes with `vercel.ai.X` ([#16908](https://github.com/getsentry/sentry-javascript/pull/16908))
100+
- feat(nextjs): Add `disableSentryWebpackConfig` flag ([#17013](https://github.com/getsentry/sentry-javascript/pull/17013))
101+
- feat(nextjs): Build app manifest ([#16851](https://github.com/getsentry/sentry-javascript/pull/16851))
102+
- feat(nextjs): Inject manifest into client for turbopack builds ([#16902](https://github.com/getsentry/sentry-javascript/pull/16902))
103+
- feat(nextjs): Inject manifest into client for webpack builds ([#16857](https://github.com/getsentry/sentry-javascript/pull/16857))
104+
- feat(node-native): Add option to disable event loop blocked detection ([#16919](https://github.com/getsentry/sentry-javascript/pull/16919))
105+
- feat(react-router): Ensure http.server route handling is consistent ([#16986](https://github.com/getsentry/sentry-javascript/pull/16986))
106+
- fix(core): Avoid prolonging idle span when starting standalone span ([#16928](https://github.com/getsentry/sentry-javascript/pull/16928))
107+
- fix(core): Remove side-effect from `tracing/errors.ts` ([#16888](https://github.com/getsentry/sentry-javascript/pull/16888))
108+
- fix(core): Wrap `beforeSendLog` in `consoleSandbox` ([#16968](https://github.com/getsentry/sentry-javascript/pull/16968))
109+
- fix(node-core): Apply correct SDK metadata ([#17014](https://github.com/getsentry/sentry-javascript/pull/17014))
110+
- fix(react-router): Ensure that all browser spans have `source=route` ([#16984](https://github.com/getsentry/sentry-javascript/pull/16984))
111+
7112
Work in this release was contributed by @janpapenbrock. Thank you for your contribution!
8113

9114
## 9.38.0

0 commit comments

Comments
 (0)