Skip to content

Commit 2ff5b7b

Browse files
authored
Merge pull request #12845 from getsentry/prepare-release/8.17.0
meta(changelog): Update changelog for 8.17.0
2 parents 0f36aa5 + 27626ad commit 2ff5b7b

File tree

21 files changed

+361
-203
lines changed

21 files changed

+361
-203
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ jobs:
995995
'angular-17',
996996
'angular-18',
997997
'aws-lambda-layer-cjs',
998+
'aws-serverless-esm',
998999
'node-express',
9991000
'create-react-app',
10001001
'create-next-app',

.secret_scan_ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages\/google-cloud-serverless\/test\/integrations\/private\.pem

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

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

11+
## 8.17.0
12+
13+
- feat: Upgrade OTEL deps (#12809)
14+
- fix(nuxt): Add module to build:transpile script (#12843)
15+
- fix(browser): Allow SDK initialization in NW.js apps (#12846)
16+
1117
## 8.16.0
1218

1319
### Important Changes

dev-packages/e2e-tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"esbuild": "0.20.0",
2424
"glob": "8.0.3",
2525
"ts-node": "10.9.1",
26-
"yaml": "2.2.2"
26+
"yaml": "2.2.2",
27+
"rimraf": "^5.0.0"
2728
},
2829
"volta": {
2930
"extends": "../../package.json",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@sentry:registry=http://127.0.0.1:4873
2+
@sentry-internal:registry=http://127.0.0.1:4873
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "node-express-app",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"start": "node src/run.mjs",
7+
"test": "playwright test",
8+
"clean": "npx rimraf node_modules pnpm-lock.yaml",
9+
"test:build": "pnpm install",
10+
"test:assert": "pnpm test"
11+
},
12+
"dependencies": {
13+
"@sentry/aws-serverless": "* || latest"
14+
},
15+
"devDependencies": {
16+
"@sentry-internal/test-utils": "link:../../../test-utils",
17+
"@playwright/test": "^1.41.1",
18+
"wait-port": "1.0.4"
19+
},
20+
"volta": {
21+
"extends": "../../package.json"
22+
}
23+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
2+
3+
// Fix urls not resolving to localhost on Node v17+
4+
// See: https://github.com/axios/axios/issues/3821#issuecomment-1413727575
5+
import { setDefaultResultOrder } from 'dns';
6+
setDefaultResultOrder('ipv4first');
7+
8+
const eventProxyPort = 3031;
9+
10+
/**
11+
* See https://playwright.dev/docs/test-configuration.
12+
*/
13+
const config = getPlaywrightConfig(
14+
{ startCommand: '' },
15+
{
16+
/* Run your local dev server before starting the tests */
17+
webServer: [
18+
{
19+
command: `node start-event-proxy.mjs && pnpm wait-port ${eventProxyPort}`,
20+
port: eventProxyPort,
21+
stdout: 'pipe',
22+
},
23+
],
24+
},
25+
);
26+
27+
export default config;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import * as http from 'node:http';
2+
import * as Sentry from '@sentry/aws-serverless';
3+
4+
const handler = Sentry.wrapHandler(async () => {
5+
await new Promise(resolve => {
6+
const req = http.request(
7+
{
8+
host: 'example.com',
9+
},
10+
res => {
11+
res.on('data', d => {
12+
process.stdout.write(d);
13+
});
14+
15+
res.on('end', () => {
16+
resolve();
17+
});
18+
},
19+
);
20+
req.end();
21+
});
22+
23+
Sentry.startSpan({ name: 'manual-span', op: 'manual' }, () => {});
24+
});
25+
26+
export { handler };
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"//": "This is a mock package.json file which is usually created by AWS when deploying the lambda. OTEL instrumentation tries to read this file to get the lambda version",
3+
"name": "lambda",
4+
"version": "1.0.0"
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { handler } from './lambda-function.mjs';
2+
3+
// Simulate minimal event and context objects being passed to the handler by the AWS runtime
4+
const event = {};
5+
const context = {
6+
invokedFunctionArn: 'arn:aws:lambda:us-east-1:123453789012:function:my-lambda',
7+
functionName: 'my-lambda',
8+
};
9+
10+
await handler(event, context);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import child_process from 'child_process';
2+
3+
child_process.execSync('node ./src/run-lambda.mjs', {
4+
stdio: 'inherit',
5+
env: {
6+
...process.env,
7+
// On AWS, LAMBDA_TASK_ROOT is usually /var/task but for testing, we set it to the CWD to correctly apply our handler
8+
LAMBDA_TASK_ROOT: process.cwd(),
9+
_HANDLER: 'src/lambda-function.handler',
10+
11+
NODE_OPTIONS: '--import @sentry/aws-serverless/awslambda-auto',
12+
SENTRY_DSN: 'http://public@localhost:3031/1337',
13+
SENTRY_TRACES_SAMPLE_RATE: '1.0',
14+
},
15+
cwd: process.cwd(),
16+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { startEventProxyServer } from '@sentry-internal/test-utils';
2+
3+
startEventProxyServer({
4+
port: 3031,
5+
proxyServerName: 'aws-serverless-esm',
6+
forwardToSentry: false,
7+
});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import * as child_process from 'child_process';
2+
import { expect, test } from '@playwright/test';
3+
import { waitForTransaction } from '@sentry-internal/test-utils';
4+
5+
test('AWS Serverless SDK sends events in ESM mode', async ({ request }) => {
6+
const transactionEventPromise = waitForTransaction('aws-serverless-esm', transactionEvent => {
7+
return transactionEvent?.transaction === 'my-lambda';
8+
});
9+
10+
// Waiting for 1s here because attaching the listener for events in `waitForTransaction` is not synchronous
11+
// Since in this test, we don't start a browser via playwright, we don't have the usual delays (page.goto, etc)
12+
// which are usually enough for us to never have noticed this race condition before.
13+
// This is a workaround but probably sufficient as long as we only experience it in this test.
14+
await new Promise<void>(resolve =>
15+
setTimeout(() => {
16+
resolve();
17+
}, 1000),
18+
);
19+
20+
child_process.execSync('pnpm start', {
21+
stdio: 'ignore',
22+
});
23+
24+
const transactionEvent = await transactionEventPromise;
25+
26+
// shows the SDK sent a transaction
27+
expect(transactionEvent.transaction).toEqual('my-lambda'); // name should be the function name
28+
expect(transactionEvent.contexts?.trace).toEqual({
29+
data: {
30+
'sentry.sample_rate': 1,
31+
'sentry.source': 'component',
32+
'sentry.origin': 'auto.function.serverless',
33+
'sentry.op': 'function.aws.lambda',
34+
'otel.kind': 'INTERNAL',
35+
},
36+
op: 'function.aws.lambda',
37+
origin: 'auto.function.serverless',
38+
span_id: expect.any(String),
39+
status: 'ok',
40+
trace_id: expect.any(String),
41+
});
42+
43+
expect(transactionEvent.spans).toHaveLength(2);
44+
45+
// shows that the Otel Http instrumentation is working
46+
expect(transactionEvent.spans).toContainEqual(
47+
expect.objectContaining({
48+
data: expect.objectContaining({
49+
'sentry.op': 'http.client',
50+
'sentry.origin': 'auto.http.otel.http',
51+
url: 'http://example.com/',
52+
}),
53+
description: 'GET http://example.com/',
54+
op: 'http.client',
55+
}),
56+
);
57+
58+
// shows that the manual span creation is working
59+
expect(transactionEvent.spans).toContainEqual(
60+
expect.objectContaining({
61+
data: expect.objectContaining({
62+
'sentry.op': 'manual',
63+
'sentry.origin': 'manual',
64+
}),
65+
description: 'manual-span',
66+
op: 'manual',
67+
}),
68+
);
69+
});

packages/aws-serverless/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"./awslambda-auto": {
4242
"require": {
4343
"default": "./build/npm/cjs/awslambda-auto.js"
44+
},
45+
"import": {
46+
"default": "./build/npm/esm/awslambda-auto.js"
4447
}
4548
},
4649
"./dist/awslambda-auto": {

packages/browser/src/sdk.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {
6363
type ExtensionProperties = {
6464
chrome?: Runtime;
6565
browser?: Runtime;
66+
nw?: unknown;
6667
};
6768
type Runtime = {
6869
runtime?: {
@@ -85,7 +86,11 @@ function shouldShowBrowserExtensionError(): boolean {
8586
const isDedicatedExtensionPage =
8687
!!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));
8788

88-
return !!runtimeId && !isDedicatedExtensionPage;
89+
// Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine
90+
// see: https://github.com/getsentry/sentry-javascript/issues/12668
91+
const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';
92+
93+
return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;
8994
}
9095

9196
/**

packages/browser/test/unit/sdk.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ describe('init', () => {
142142
afterEach(() => {
143143
Object.defineProperty(WINDOW, 'chrome', { value: undefined, writable: true });
144144
Object.defineProperty(WINDOW, 'browser', { value: undefined, writable: true });
145+
Object.defineProperty(WINDOW, 'nw', { value: undefined, writable: true });
145146
});
146147

147148
it('logs a browser extension error if executed inside a Chrome extension', () => {
@@ -210,6 +211,18 @@ describe('init', () => {
210211
consoleErrorSpy.mockRestore();
211212
});
212213

214+
it("doesn't log a browser extension error if executed inside an NW.js environment", () => {
215+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
216+
217+
Object.defineProperty(WINDOW, 'nw', { value: {} });
218+
219+
init(options);
220+
221+
expect(consoleErrorSpy).not.toHaveBeenCalled();
222+
223+
consoleErrorSpy.mockRestore();
224+
});
225+
213226
it("doesn't return a client on initialization error", () => {
214227
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
215228

packages/node/package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@
6969
"@opentelemetry/context-async-hooks": "^1.25.1",
7070
"@opentelemetry/core": "^1.25.1",
7171
"@opentelemetry/instrumentation": "^0.52.1",
72-
"@opentelemetry/instrumentation-connect": "0.37.0",
73-
"@opentelemetry/instrumentation-express": "0.40.1",
74-
"@opentelemetry/instrumentation-fastify": "0.37.0",
75-
"@opentelemetry/instrumentation-graphql": "0.41.0",
76-
"@opentelemetry/instrumentation-hapi": "0.39.0",
72+
"@opentelemetry/instrumentation-connect": "0.38.0",
73+
"@opentelemetry/instrumentation-express": "0.41.0",
74+
"@opentelemetry/instrumentation-fastify": "0.38.0",
75+
"@opentelemetry/instrumentation-graphql": "0.42.0",
76+
"@opentelemetry/instrumentation-hapi": "0.40.0",
7777
"@opentelemetry/instrumentation-http": "0.52.1",
78-
"@opentelemetry/instrumentation-ioredis": "0.41.0",
79-
"@opentelemetry/instrumentation-koa": "0.41.0",
80-
"@opentelemetry/instrumentation-mongodb": "0.45.0",
81-
"@opentelemetry/instrumentation-mongoose": "0.39.0",
82-
"@opentelemetry/instrumentation-mysql": "0.39.0",
83-
"@opentelemetry/instrumentation-mysql2": "0.39.0",
84-
"@opentelemetry/instrumentation-nestjs-core": "0.38.0",
85-
"@opentelemetry/instrumentation-pg": "0.42.0",
86-
"@opentelemetry/instrumentation-redis-4": "0.40.0",
78+
"@opentelemetry/instrumentation-ioredis": "0.42.0",
79+
"@opentelemetry/instrumentation-koa": "0.42.0",
80+
"@opentelemetry/instrumentation-mongodb": "0.46.0",
81+
"@opentelemetry/instrumentation-mongoose": "0.40.0",
82+
"@opentelemetry/instrumentation-mysql": "0.40.0",
83+
"@opentelemetry/instrumentation-mysql2": "0.40.0",
84+
"@opentelemetry/instrumentation-nestjs-core": "0.39.0",
85+
"@opentelemetry/instrumentation-pg": "0.43.0",
86+
"@opentelemetry/instrumentation-redis-4": "0.41.0",
8787
"@opentelemetry/resources": "^1.25.1",
8888
"@opentelemetry/sdk-trace-base": "^1.25.1",
8989
"@opentelemetry/semantic-conventions": "^1.25.1",
@@ -97,7 +97,7 @@
9797
"@types/node": "^14.18.0"
9898
},
9999
"optionalDependencies": {
100-
"opentelemetry-instrumentation-fetch-node": "1.2.0"
100+
"opentelemetry-instrumentation-fetch-node": "1.2.3"
101101
},
102102
"scripts": {
103103
"build": "run-p build:transpile build:types",

packages/node/src/integrations/tracing/koa.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const instrumentKoa = generateInstrumentOnce(
3030
}
3131
const attributes = spanToJSON(span).data;
3232
const route = attributes && attributes[SEMATTRS_HTTP_ROUTE];
33-
const method = info.context.request.method.toUpperCase() || 'GET';
33+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
34+
const method: string = info?.context?.request?.method?.toUpperCase() || 'GET';
3435
if (route) {
3536
getIsolationScope().setTransactionName(`${method} ${route}`);
3637
}

packages/nuxt/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ The minimum supported version of Nuxt is `3.0.0`.
2828
This package is a wrapper around `@sentry/node` for the server and `@sentry/vue` for the client side, with added
2929
functionality related to Nuxt.
3030

31+
What is working:
32+
33+
- Error Reporting
34+
35+
What is partly working:
36+
37+
- Tracing by setting `tracesSampleRate`
38+
39+
What is not yet(!) included:
40+
41+
- Source Maps
42+
- Connected Traces
43+
3144
## Automatic Setup
3245

3346
todo: add wizard instructions

packages/nuxt/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
"nuxt": "^3.12.2"
5858
},
5959
"scripts": {
60-
"build": "run-p build:transpile build:types build:nuxt-module",
60+
"build": "run-s build:types build:transpile",
6161
"build:dev": "yarn build",
6262
"build:nuxt-module": "nuxt-module-build build --outDir build/module",
63-
"build:transpile": "rollup -c rollup.npm.config.mjs",
63+
"build:transpile": "rollup -c rollup.npm.config.mjs && yarn build:nuxt-module",
6464
"build:types": "tsc -p tsconfig.types.json",
6565
"build:watch": "run-p build:transpile:watch build:types:watch",
6666
"build:dev:watch": "yarn build:watch",
@@ -84,10 +84,12 @@
8484
"build:transpile": {
8585
"dependsOn": [
8686
"^build:transpile",
87-
"^build:types"
87+
"^build:types",
88+
"build:types"
8889
],
8990
"outputs": [
90-
"{projectRoot}/build",
91+
"{projectRoot}/build/cjs",
92+
"{projectRoot}/build/esm",
9193
"{projectRoot}/build/module"
9294
]
9395
}

0 commit comments

Comments
 (0)