Skip to content

meta(changelog): Update changelog for 8.17.0 #12845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ jobs:
'angular-17',
'angular-18',
'aws-lambda-layer-cjs',
'aws-serverless-esm',
'node-express',
'create-react-app',
'create-next-app',
Expand Down
1 change: 1 addition & 0 deletions .secret_scan_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages\/google-cloud-serverless\/test\/integrations\/private\.pem
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

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

## 8.17.0

- feat: Upgrade OTEL deps (#12809)
- fix(nuxt): Add module to build:transpile script (#12843)
- fix(browser): Allow SDK initialization in NW.js apps (#12846)

## 8.16.0

### Important Changes
Expand Down
3 changes: 2 additions & 1 deletion dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"esbuild": "0.20.0",
"glob": "8.0.3",
"ts-node": "10.9.1",
"yaml": "2.2.2"
"yaml": "2.2.2",
"rimraf": "^5.0.0"
},
"volta": {
"extends": "../../package.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@sentry:registry=http://127.0.0.1:4873
@sentry-internal:registry=http://127.0.0.1:4873
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "node-express-app",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node src/run.mjs",
"test": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install",
"test:assert": "pnpm test"
},
"dependencies": {
"@sentry/aws-serverless": "* || latest"
},
"devDependencies": {
"@sentry-internal/test-utils": "link:../../../test-utils",
"@playwright/test": "^1.41.1",
"wait-port": "1.0.4"
},
"volta": {
"extends": "../../package.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { getPlaywrightConfig } from '@sentry-internal/test-utils';

// Fix urls not resolving to localhost on Node v17+
// See: https://github.com/axios/axios/issues/3821#issuecomment-1413727575
import { setDefaultResultOrder } from 'dns';
setDefaultResultOrder('ipv4first');

const eventProxyPort = 3031;

/**
* See https://playwright.dev/docs/test-configuration.
*/
const config = getPlaywrightConfig(
{ startCommand: '' },
{
/* Run your local dev server before starting the tests */
webServer: [
{
command: `node start-event-proxy.mjs && pnpm wait-port ${eventProxyPort}`,
port: eventProxyPort,
stdout: 'pipe',
},
],
},
);

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as http from 'node:http';
import * as Sentry from '@sentry/aws-serverless';

const handler = Sentry.wrapHandler(async () => {
await new Promise(resolve => {
const req = http.request(
{
host: 'example.com',
},
res => {
res.on('data', d => {
process.stdout.write(d);
});

res.on('end', () => {
resolve();
});
},
);
req.end();
});

Sentry.startSpan({ name: 'manual-span', op: 'manual' }, () => {});
});

export { handler };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"//": "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",
"name": "lambda",
"version": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { handler } from './lambda-function.mjs';

// Simulate minimal event and context objects being passed to the handler by the AWS runtime
const event = {};
const context = {
invokedFunctionArn: 'arn:aws:lambda:us-east-1:123453789012:function:my-lambda',
functionName: 'my-lambda',
};

await handler(event, context);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import child_process from 'child_process';

child_process.execSync('node ./src/run-lambda.mjs', {
stdio: 'inherit',
env: {
...process.env,
// On AWS, LAMBDA_TASK_ROOT is usually /var/task but for testing, we set it to the CWD to correctly apply our handler
LAMBDA_TASK_ROOT: process.cwd(),
_HANDLER: 'src/lambda-function.handler',

NODE_OPTIONS: '--import @sentry/aws-serverless/awslambda-auto',
SENTRY_DSN: 'http://public@localhost:3031/1337',
SENTRY_TRACES_SAMPLE_RATE: '1.0',
},
cwd: process.cwd(),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { startEventProxyServer } from '@sentry-internal/test-utils';

startEventProxyServer({
port: 3031,
proxyServerName: 'aws-serverless-esm',
forwardToSentry: false,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import * as child_process from 'child_process';
import { expect, test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';

test('AWS Serverless SDK sends events in ESM mode', async ({ request }) => {
const transactionEventPromise = waitForTransaction('aws-serverless-esm', transactionEvent => {
return transactionEvent?.transaction === 'my-lambda';
});

// Waiting for 1s here because attaching the listener for events in `waitForTransaction` is not synchronous
// Since in this test, we don't start a browser via playwright, we don't have the usual delays (page.goto, etc)
// which are usually enough for us to never have noticed this race condition before.
// This is a workaround but probably sufficient as long as we only experience it in this test.
await new Promise<void>(resolve =>
setTimeout(() => {
resolve();
}, 1000),
);

child_process.execSync('pnpm start', {
stdio: 'ignore',
});

const transactionEvent = await transactionEventPromise;

// shows the SDK sent a transaction
expect(transactionEvent.transaction).toEqual('my-lambda'); // name should be the function name
expect(transactionEvent.contexts?.trace).toEqual({
data: {
'sentry.sample_rate': 1,
'sentry.source': 'component',
'sentry.origin': 'auto.function.serverless',
'sentry.op': 'function.aws.lambda',
'otel.kind': 'INTERNAL',
},
op: 'function.aws.lambda',
origin: 'auto.function.serverless',
span_id: expect.any(String),
status: 'ok',
trace_id: expect.any(String),
});

expect(transactionEvent.spans).toHaveLength(2);

// shows that the Otel Http instrumentation is working
expect(transactionEvent.spans).toContainEqual(
expect.objectContaining({
data: expect.objectContaining({
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.otel.http',
url: 'http://example.com/',
}),
description: 'GET http://example.com/',
op: 'http.client',
}),
);

// shows that the manual span creation is working
expect(transactionEvent.spans).toContainEqual(
expect.objectContaining({
data: expect.objectContaining({
'sentry.op': 'manual',
'sentry.origin': 'manual',
}),
description: 'manual-span',
op: 'manual',
}),
);
});
3 changes: 3 additions & 0 deletions packages/aws-serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"./awslambda-auto": {
"require": {
"default": "./build/npm/cjs/awslambda-auto.js"
},
"import": {
"default": "./build/npm/esm/awslambda-auto.js"
}
},
"./dist/awslambda-auto": {
Expand Down
7 changes: 6 additions & 1 deletion packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {
type ExtensionProperties = {
chrome?: Runtime;
browser?: Runtime;
nw?: unknown;
};
type Runtime = {
runtime?: {
Expand All @@ -85,7 +86,11 @@ function shouldShowBrowserExtensionError(): boolean {
const isDedicatedExtensionPage =
!!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));

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

return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions packages/browser/test/unit/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ describe('init', () => {
afterEach(() => {
Object.defineProperty(WINDOW, 'chrome', { value: undefined, writable: true });
Object.defineProperty(WINDOW, 'browser', { value: undefined, writable: true });
Object.defineProperty(WINDOW, 'nw', { value: undefined, writable: true });
});

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

it("doesn't log a browser extension error if executed inside an NW.js environment", () => {
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});

Object.defineProperty(WINDOW, 'nw', { value: {} });

init(options);

expect(consoleErrorSpy).not.toHaveBeenCalled();

consoleErrorSpy.mockRestore();
});

it("doesn't return a client on initialization error", () => {
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});

Expand Down
30 changes: 15 additions & 15 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@
"@opentelemetry/context-async-hooks": "^1.25.1",
"@opentelemetry/core": "^1.25.1",
"@opentelemetry/instrumentation": "^0.52.1",
"@opentelemetry/instrumentation-connect": "0.37.0",
"@opentelemetry/instrumentation-express": "0.40.1",
"@opentelemetry/instrumentation-fastify": "0.37.0",
"@opentelemetry/instrumentation-graphql": "0.41.0",
"@opentelemetry/instrumentation-hapi": "0.39.0",
"@opentelemetry/instrumentation-connect": "0.38.0",
"@opentelemetry/instrumentation-express": "0.41.0",
"@opentelemetry/instrumentation-fastify": "0.38.0",
"@opentelemetry/instrumentation-graphql": "0.42.0",
"@opentelemetry/instrumentation-hapi": "0.40.0",
"@opentelemetry/instrumentation-http": "0.52.1",
"@opentelemetry/instrumentation-ioredis": "0.41.0",
"@opentelemetry/instrumentation-koa": "0.41.0",
"@opentelemetry/instrumentation-mongodb": "0.45.0",
"@opentelemetry/instrumentation-mongoose": "0.39.0",
"@opentelemetry/instrumentation-mysql": "0.39.0",
"@opentelemetry/instrumentation-mysql2": "0.39.0",
"@opentelemetry/instrumentation-nestjs-core": "0.38.0",
"@opentelemetry/instrumentation-pg": "0.42.0",
"@opentelemetry/instrumentation-redis-4": "0.40.0",
"@opentelemetry/instrumentation-ioredis": "0.42.0",
"@opentelemetry/instrumentation-koa": "0.42.0",
"@opentelemetry/instrumentation-mongodb": "0.46.0",
"@opentelemetry/instrumentation-mongoose": "0.40.0",
"@opentelemetry/instrumentation-mysql": "0.40.0",
"@opentelemetry/instrumentation-mysql2": "0.40.0",
"@opentelemetry/instrumentation-nestjs-core": "0.39.0",
"@opentelemetry/instrumentation-pg": "0.43.0",
"@opentelemetry/instrumentation-redis-4": "0.41.0",
"@opentelemetry/resources": "^1.25.1",
"@opentelemetry/sdk-trace-base": "^1.25.1",
"@opentelemetry/semantic-conventions": "^1.25.1",
Expand All @@ -97,7 +97,7 @@
"@types/node": "^14.18.0"
},
"optionalDependencies": {
"opentelemetry-instrumentation-fetch-node": "1.2.0"
"opentelemetry-instrumentation-fetch-node": "1.2.3"
},
"scripts": {
"build": "run-p build:transpile build:types",
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/tracing/koa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const instrumentKoa = generateInstrumentOnce(
}
const attributes = spanToJSON(span).data;
const route = attributes && attributes[SEMATTRS_HTTP_ROUTE];
const method = info.context.request.method.toUpperCase() || 'GET';
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const method: string = info?.context?.request?.method?.toUpperCase() || 'GET';
if (route) {
getIsolationScope().setTransactionName(`${method} ${route}`);
}
Expand Down
13 changes: 13 additions & 0 deletions packages/nuxt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ The minimum supported version of Nuxt is `3.0.0`.
This package is a wrapper around `@sentry/node` for the server and `@sentry/vue` for the client side, with added
functionality related to Nuxt.

What is working:

- Error Reporting

What is partly working:

- Tracing by setting `tracesSampleRate`

What is not yet(!) included:

- Source Maps
- Connected Traces

## Automatic Setup

todo: add wizard instructions
Expand Down
10 changes: 6 additions & 4 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
"nuxt": "^3.12.2"
},
"scripts": {
"build": "run-p build:transpile build:types build:nuxt-module",
"build": "run-s build:types build:transpile",
"build:dev": "yarn build",
"build:nuxt-module": "nuxt-module-build build --outDir build/module",
"build:transpile": "rollup -c rollup.npm.config.mjs",
"build:transpile": "rollup -c rollup.npm.config.mjs && yarn build:nuxt-module",
"build:types": "tsc -p tsconfig.types.json",
"build:watch": "run-p build:transpile:watch build:types:watch",
"build:dev:watch": "yarn build:watch",
Expand All @@ -84,10 +84,12 @@
"build:transpile": {
"dependsOn": [
"^build:transpile",
"^build:types"
"^build:types",
"build:types"
],
"outputs": [
"{projectRoot}/build",
"{projectRoot}/build/cjs",
"{projectRoot}/build/esm",
"{projectRoot}/build/module"
]
}
Expand Down
Loading
Loading