Skip to content

Commit df78783

Browse files
authored
Merge branch 'develop' into timfish/feat/browser-view-hierarchy
2 parents 1c0b9ce + 8c4ae52 commit df78783

File tree

499 files changed

+6960
-3877
lines changed

Some content is hidden

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

499 files changed

+6960
-3877
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ jobs:
267267
run: yarn lint:lerna
268268
- name: Lint C++ files
269269
run: yarn lint:clang
270+
- name: Lint for ES compatibility
271+
run: yarn lint:es-compatibility
270272

271273
job_check_format:
272274
name: Check file formatting
@@ -1200,7 +1202,8 @@ jobs:
12001202
- name: Run E2E test
12011203
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
12021204
timeout-minutes: 10
1203-
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:assert
1205+
run: |
1206+
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:assert
12041207
12051208
job_required_jobs_passed:
12061209
name: All required jobs passed or were skipped

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,50 @@
1212

1313
Work in this release was contributed by @aloisklink, @arturovt, @benjick and @maximepvrt. Thank you for your contributions!
1414

15+
- **feat(solidstart)!: Default to `--import` setup and add `autoInjectServerSentry` ([#14862](https://github.com/getsentry/sentry-javascript/pull/14862))**
16+
17+
To enable the SolidStart SDK, wrap your SolidStart Config with `withSentry`. The `sentrySolidStartVite` plugin is now automatically
18+
added by `withSentry` and you can pass the Sentry build-time options like this:
19+
20+
```js
21+
import { defineConfig } from '@solidjs/start/config';
22+
import { withSentry } from '@sentry/solidstart';
23+
24+
export default defineConfig(
25+
withSentry(
26+
{
27+
/* Your SolidStart config options... */
28+
},
29+
{
30+
// Options for setting up source maps
31+
org: process.env.SENTRY_ORG,
32+
project: process.env.SENTRY_PROJECT,
33+
authToken: process.env.SENTRY_AUTH_TOKEN,
34+
},
35+
),
36+
);
37+
```
38+
39+
With the `withSentry` wrapper, the Sentry server config should not be added to the `public` directory anymore.
40+
Add the Sentry server config in `src/instrument.server.ts`. Then, the server config will be placed inside the server build output as `instrument.server.mjs`.
41+
42+
Now, there are two options to set up the SDK:
43+
44+
1. **(recommended)** Provide an `--import` CLI flag to the start command like this (path depends on your server setup):
45+
`node --import ./.output/server/instrument.server.mjs .output/server/index.mjs`
46+
2. Add `autoInjectServerSentry: 'top-level-import'` and the Sentry config will be imported at the top of the server entry (comes with tracing limitations)
47+
```js
48+
withSentry(
49+
{
50+
/* Your SolidStart config options... */
51+
},
52+
{
53+
// Optional: Install Sentry with a top-level import
54+
autoInjectServerSentry: 'top-level-import',
55+
},
56+
);
57+
```
58+
1559
## 8.45.0
1660

1761
- feat(core): Add `handled` option to `captureConsoleIntegration` ([#14664](https://github.com/getsentry/sentry-javascript/pull/14664))

MIGRATION.md

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -870,53 +870,35 @@ or look at the TypeScript type definitions of `withSentryConfig`.
870870
871871
#### Updated the recommended way of calling `Sentry.init()`
872872
873-
With version 8 of the SDK we will no longer support the use of `sentry.server.config.ts` and `sentry.edge.config.ts`
874-
files. Instead, please initialize the Sentry Next.js SDK for the serverside in a
875-
[Next.js instrumentation hook](https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation).
876-
**`sentry.client.config.ts|js` is still supported and encouraged for initializing the clientside SDK.**
873+
Version 8 of the Next.js SDK will require an additional `instrumentation.ts` file to execute the `sentry.server.config.js|ts` and `sentry.edge.config.js|ts` modules to initialize the SDK for the server-side.
874+
The `instrumentation.ts` file is a Next.js native API called [instrumentation hook](https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation).
877875
878-
The following is an example of how to initialize the serverside SDK in a Next.js instrumentation hook:
876+
To start using the Next.js instrumentation hook, follow these steps:
879877
880-
1. First, enable the Next.js instrumentation hook by setting the `experimental.instrumentationHook` to `true` in your
881-
`next.config.js`.
882-
2. Next, create a `instrumentation.ts|js` file in the root directory of your project (or in the `src` folder if you have
883-
have one).
884-
3. Now, export a `register` function from the `instrumentation.ts|js` file and call `Sentry.init()` inside of it:
878+
1. First, enable the Next.js instrumentation hook by setting the [`experimental.instrumentationHook`](https://nextjs.org/docs/app/api-reference/next-config-js/instrumentationHook) to true in your `next.config.js`. (This step is no longer required with Next.js 15)
885879
886-
```ts
887-
import * as Sentry from '@sentry/nextjs';
888-
889-
export function register() {
890-
if (process.env.NEXT_RUNTIME === 'nodejs') {
891-
Sentry.init({
892-
dsn: 'YOUR_DSN',
893-
// Your Node.js Sentry configuration...
894-
});
895-
}
896-
897-
if (process.env.NEXT_RUNTIME === 'edge') {
898-
Sentry.init({
899-
dsn: 'YOUR_DSN',
900-
// Your Edge Runtime Sentry configuration...
901-
});
902-
}
880+
```JavaScript {filename:next.config.js} {2-4}
881+
module.exports = {
882+
experimental: {
883+
instrumentationHook: true, // Not required on Next.js 15+
884+
},
903885
}
904886
```
905887
906-
If you need to import a Node.js specific integration (like for example `@sentry/profiling-node`), you will have to
907-
import the package using a dynamic import to prevent Next.js from bundling Node.js APIs into bundles for other
908-
runtime environments (like the Browser or the Edge runtime). You can do so as follows:
888+
2. Next, create a `instrumentation.ts|js` file in the root directory of your project (or in the src folder if you have have one).
889+
890+
3. Now, export a register function from the `instrumentation.ts|js` file and import your `sentry.server.config.js|ts` and `sentry.edge.config.js|ts` modules:
909891
910-
```ts
892+
```JavaScript {filename:instrumentation.js}
911893
import * as Sentry from '@sentry/nextjs';
912894

913895
export async function register() {
914896
if (process.env.NEXT_RUNTIME === 'nodejs') {
915-
const { nodeProfilingIntegration } = await import('@sentry/profiling-node');
916-
Sentry.init({
917-
dsn: 'YOUR_DSN',
918-
integrations: [nodeProfilingIntegration()],
919-
});
897+
await import('./sentry.server.config');
898+
}
899+
900+
if (process.env.NEXT_RUNTIME === 'edge') {
901+
await import('./sentry.edge.config');
920902
}
921903
}
922904
```

dev-packages/browser-integration-tests/loader-suites/loader/noOnLoad/customOnErrorHandler/subject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const oldOnError = window.onerror;
22

33
window.onerror = function () {
44
console.log('custom error');
5-
oldOnError && oldOnError.apply(this, arguments);
5+
oldOnError?.apply(this, arguments);
66
};
77

88
window.doSomethingWrong();

dev-packages/browser-integration-tests/suites/integrations/captureConsole-attachStackTrace/init.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ window.Sentry = Sentry;
66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
88
integrations: [captureConsoleIntegration()],
9-
autoSessionTracking: false,
109
attachStacktrace: true,
1110
});

dev-packages/browser-integration-tests/suites/integrations/captureConsole-attachStackTrace/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ sentryTest(
1919
const errorEvent = events.find(event => event.message === 'console error');
2020
const traceEvent = events.find(event => event.message === 'console trace');
2121
const errorWithErrorEvent = events.find(
22-
event => event.exception && event.exception.values?.[0].value === 'console error with error object',
22+
event => event.exception?.values?.[0].value === 'console error with error object',
2323
);
2424
const traceWithErrorEvent = events.find(
25-
event => event.exception && event.exception.values?.[0].value === 'console trace with error object',
25+
event => event.exception?.values?.[0].value === 'console trace with error object',
2626
);
2727

2828
expect(logEvent).toEqual(

dev-packages/browser-integration-tests/suites/integrations/captureConsole/init.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ window.Sentry = Sentry;
66
Sentry.init({
77
dsn: 'https://[email protected]/1337',
88
integrations: [captureConsoleIntegration()],
9-
autoSessionTracking: false,
109
});

dev-packages/browser-integration-tests/suites/integrations/captureConsole/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ sentryTest('it captures console messages correctly', async ({ getLocalTestUrl, p
1717
const errorEvent = events.find(event => event.message === 'console error');
1818
const traceEvent = events.find(event => event.message === 'console trace');
1919
const errorWithErrorEvent = events.find(
20-
event => event.exception && event.exception.values?.[0].value === 'console error with error object',
20+
event => event.exception?.values?.[0].value === 'console error with error object',
2121
);
2222
const traceWithErrorEvent = events.find(
23-
event => event.exception && event.exception.values?.[0].value === 'console trace with error object',
23+
event => event.exception?.values?.[0].value === 'console trace with error object',
2424
);
2525

2626
expect(logEvent).toEqual(

dev-packages/browser-integration-tests/suites/integrations/featureFlags/featureFlags/withScope/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ sentryTest('Flag evaluations in forked scopes are stored separately.', async ({
2222
const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true });
2323
await page.goto(url);
2424

25-
const forkedReqPromise = waitForErrorRequest(page, event => !!event.tags && event.tags.isForked === true);
26-
const mainReqPromise = waitForErrorRequest(page, event => !!event.tags && event.tags.isForked === false);
25+
const forkedReqPromise = waitForErrorRequest(page, event => !!event.tags?.isForked === true);
26+
const mainReqPromise = waitForErrorRequest(page, event => !!event.tags?.isForked === false);
2727

2828
await page.evaluate(() => {
2929
const Sentry = (window as any).Sentry;

dev-packages/browser-integration-tests/suites/integrations/featureFlags/launchdarkly/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Sentry.init({
1313
// Also, no SDK has mock utils for FlagUsedHandler's.
1414
const MockLaunchDarkly = {
1515
initialize(_clientId, context, options) {
16-
const flagUsedHandler = options && options.inspectors ? options.inspectors[0].method : undefined;
16+
const flagUsedHandler = options.inspectors ? options.inspectors[0].method : undefined;
1717

1818
return {
1919
variation(key, defaultValue) {

0 commit comments

Comments
 (0)