Skip to content

Commit 04cc919

Browse files
authored
Merge branch 'v8' into aliu/unleash
2 parents dcf2595 + 5f47fbb commit 04cc919

File tree

39 files changed

+710
-4831
lines changed

39 files changed

+710
-4831
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ jobs:
738738
node_version: ${{ matrix.node == 14 && '14' || '' }}
739739

740740
- name: Overwrite typescript version
741-
if: matrix.typescript
742-
run: node ./scripts/use-ts-version.js ${{ matrix.typescript }}
741+
if: matrix.typescript == '3.8'
742+
run: node ./scripts/use-ts-3_8.js
743743
working-directory: dev-packages/node-integration-tests
744744

745745
- name: Run integration tests

.size-limit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = [
5454
path: 'packages/browser/build/npm/esm/index.js',
5555
import: createImport('init', 'browserTracingIntegration', 'replayIntegration'),
5656
gzip: true,
57-
limit: '68 KB',
57+
limit: '68.5 KB',
5858
modifyWebpackConfig: function (config) {
5959
const webpack = require('webpack');
6060
const TerserPlugin = require('terser-webpack-plugin');

dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { expect } from '@playwright/test';
2-
import type { Event } from '@sentry/core';
3-
42
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers';
3+
import {
4+
envelopeRequestParser,
5+
shouldSkipTracingTest,
6+
waitForTransactionRequestOnUrl,
7+
} from '../../../../utils/helpers';
68

79
sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, page }) => {
810
if (shouldSkipTracingTest()) {
@@ -11,14 +13,8 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p
1113

1214
const url = await getLocalTestUrl({ testDir: __dirname });
1315

14-
// Because we fetch from http://example.com, fetch will throw a CORS error in firefox and webkit.
15-
// Chromium does not throw for cors errors.
16-
// This means that we will intercept a dynamic amount of envelopes here.
17-
18-
// We will wait 500ms for all envelopes to be sent. Generally, in all browsers, the last sent
19-
// envelope contains tracing data.
20-
const envelopes = await getMultipleSentryEnvelopeRequests<Event>(page, 4, { url, timeout: 10000 });
21-
const tracingEvent = envelopes.find(event => event.type === 'transaction')!; // last envelope contains tracing data on all browsers
16+
const req = await waitForTransactionRequestOnUrl(page, url);
17+
const tracingEvent = envelopeRequestParser(req);
2218

2319
const requestSpans = tracingEvent.spans?.filter(({ op }) => op === 'http.client');
2420

dev-packages/browser-integration-tests/suites/tracing/request/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Sentry.init({
77
integrations: [Sentry.browserTracingIntegration()],
88
tracePropagationTargets: ['http://example.com'],
99
tracesSampleRate: 1,
10+
autoSessionTracking: false,
1011
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
import { makeMultiplexedTransport } from '@sentry/browser';
4+
5+
window.Sentry = Sentry;
6+
7+
Sentry.init({
8+
dsn: 'https://[email protected]/1337',
9+
transport: makeMultiplexedTransport(Sentry.makeFetchTransport, ({ getEvent }) => {
10+
const event = getEvent('event');
11+
12+
if (event.tags.to === 'a') {
13+
return ['https://[email protected]/1337'];
14+
} else if (event.tags.to === 'b') {
15+
return ['https://[email protected]/1337'];
16+
} else {
17+
throw new Error('Unknown destination');
18+
}
19+
}),
20+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
setTimeout(() => {
2+
Sentry.withScope(scope => {
3+
scope.setTag('to', 'a');
4+
Sentry.captureException(new Error('Error a'));
5+
});
6+
Sentry.withScope(scope => {
7+
scope.setTag('to', 'b');
8+
Sentry.captureException(new Error('Error b'));
9+
});
10+
}, 0);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/core';
3+
4+
import { sentryTest } from '../../../utils/fixtures';
5+
import { getMultipleSentryEnvelopeRequests } from '../../../utils/helpers';
6+
7+
sentryTest('sends event to DSNs specified in makeMultiplexedTransport', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
9+
const errorEvents = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { envelopeType: 'event', url });
10+
11+
expect(errorEvents).toHaveLength(2);
12+
13+
const [evt1, evt2] = errorEvents;
14+
15+
const errorA = evt1?.tags?.to === 'a' ? evt1 : evt2;
16+
const errorB = evt1?.tags?.to === 'b' ? evt1 : evt2;
17+
18+
expect(errorA.tags?.to).toBe('a');
19+
expect(errorB.tags?.to).toBe('b');
20+
});

dev-packages/browser-integration-tests/utils/generatePlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import type { Package } from '@sentry/core';
3+
import { type Package } from '@sentry/core';
44
import HtmlWebpackPlugin, { createHtmlTagObject } from 'html-webpack-plugin';
55
import type { Compiler } from 'webpack';
66

@@ -38,6 +38,8 @@ const IMPORTED_INTEGRATION_CDN_BUNDLE_PATHS: Record<string, string> = {
3838
sessionTimingIntegration: 'sessiontiming',
3939
feedbackIntegration: 'feedback',
4040
moduleMetadataIntegration: 'modulemetadata',
41+
// technically, this is not an integration, but let's add it anyway for simplicity
42+
makeMultiplexedTransport: 'multiplexedtransport',
4143
};
4244

4345
const BUNDLE_PATHS: Record<string, Record<string, string>> = {

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"eslint-plugin-react": "^7.33.2",
4545
"eslint-plugin-react-hooks": "^4.6.0",
4646
"typescript": "^5.1.6",
47-
"vite": "^5.4.10",
47+
"vite": "^5.4.11",
4848
"vite-tsconfig-paths": "^4.2.1"
4949
},
5050
"volta": {

dev-packages/e2e-tests/test-applications/nestjs-fastify/src/app.controller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Controller, Get, Param, ParseIntPipe, UseFilters, UseGuards, UseInterceptors } from '@nestjs/common';
1+
import { All, Controller, Get, Param, ParseIntPipe, UseFilters, UseGuards, UseInterceptors } from '@nestjs/common';
22
import { flush } from '@sentry/nestjs';
33
import { AppService } from './app.service';
44
import { AsyncInterceptor } from './async-example.interceptor';
@@ -121,4 +121,9 @@ export class AppController {
121121
testFunctionName() {
122122
return this.appService.getFunctionName();
123123
}
124+
125+
@All('test-all')
126+
testAll() {
127+
return {};
128+
}
124129
}

0 commit comments

Comments
 (0)