Skip to content

Commit

Permalink
Merge pull request #7919 from getsentry/prepare-release/7.49.0
Browse files Browse the repository at this point in the history
meta(changelog): Update CHANGELOG for 7.49.0
  • Loading branch information
mydea authored Apr 20, 2023
2 parents af04395 + 0b65590 commit 1f34b16
Show file tree
Hide file tree
Showing 65 changed files with 1,637 additions and 186 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [8, 10, 12, 14, 16, 18]
node: [8, 10, 12, 14, 16, 18, 20]
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand Down Expand Up @@ -698,7 +698,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [10, 12, 14, 16, 18]
node: [10, 12, 14, 16, 18, 20]
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gitflow-sync-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:

- name: Enable automerge for PR
run: gh pr merge --merge --auto "1"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/marketplace/actions/auto-approve
- name: Auto approve PR
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/label-last-commenter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Tag issues with last commenter'

on:
issue_comment:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ !github.event.issue.pull_request }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Add label if commenter is not member
if: |
github.event.comment.author_association != 'COLLABORATOR'
&& github.event.comment.author_association != 'MEMBER'
&& github.event.comment.author_association != 'OWNER'
uses: actions-ecosystem/action-add-labels@v1
with:
labels: 'Waiting for: Team'

- name: Remove label if commenter is member
if: |
github.event.comment.author_association == 'COLLABORATOR'
|| github.event.comment.author_association == 'MEMBER'
|| github.event.comment.author_association == 'OWNER'
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: 'Waiting for: Team'
46 changes: 44 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@

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

## 7.49.0

### Important Changes

- **feat(sveltekit): Read adapter output directory from `svelte.config.js` (#7863)**

Our source maps upload plugin is now able to read `svelte.config.js`. This is necessary to automatically find the output directory that users can specify when setting up the Node adapter.

- **fix(replay): Ensure we normalize scope breadcrumbs to max. depth to avoid circular ref (#7915)**

This release fixes a potential problem with how Replay captures console logs.
Any objects logged will now be cut off after a maximum depth of 10, as well as cutting off any properties after the 1000th.
This should ensure we do not accidentally capture massive console logs, where a stringified object could reach 100MB or more.

- **fix(utils): Normalize HTML elements as string (#7916)**

We used to normalize references to HTML elements as POJOs.
This is both not very easily understandable, as well as potentially large, as HTML elements may have properties attached to them.
With this change, we now normalize them to e.g. `[HTMLElement: HTMLInputElement]`.

### Additional Features and Fixes

- feat(browser): Simplify stack parsers (#7897)
- feat(node): Add monitor upsert types (#7914)
- feat(replay): Truncate network bodies to max size (#7875)
- fix(gatsby): Don't crash build when auth token is missing (#7858)
- fix(gatsby): Use `import` for `gatsby-browser.js` instead of `require` (#7889)
- fix(nextjs): Handle braces in stack frame URLs (#7900)
- fix(nextjs): Mark value injection loader result as uncacheable (#7870)
- fix(node): Correct typo in trpc integration transaciton name (#7871)
- fix(node): reduce deepReadDirSync runtime complexity (#7910)
- fix(sveltekit): Avoid capturing "Not Found" errors in server `handleError` wrapper (#7898)
- fix(sveltekit): Detect sentry release before creating the Vite plugins (#7902)
- fix(sveltekit): Use `sentry.properties` file when uploading source maps (#7890)
- fix(tracing): Ensure we use s instead of ms for startTimestamp (#7877)
- ref(deprecate): Deprecate `timestampWithMs` (#7878)
- ref(nextjs): Don't use Sentry Webpack Plugin in dev mode (#7901)

## 7.48.0

### Important Changes
Expand All @@ -26,7 +64,7 @@ import * as Sentry from '@sentry/node';
const requestHandler = (ctx, next) => {
return new Promise((resolve, reject) => {
Sentry.runWithAsyncContext(async () => {
const hub = Sentry.geCurrentHub();
const hub = Sentry.getCurrentHub();

hub.configureScope(scope =>
scope.addEventProcessor(event =>
Expand All @@ -38,7 +76,11 @@ const requestHandler = (ctx, next) => {
)
);

await next();
try {
await next();
} catch (err) {
reject(err);
}
resolve();
});
});
Expand Down
4 changes: 4 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Deprecations in 7.x

## Deprecate `timestampWithMs` export - #7878

The `timestampWithMs` util is deprecated in favor of using `timestampInSeconds`.

## Remove requirement for `@sentry/tracing` package (since 7.46.0)

With `7.46.0` you no longer require the `@sentry/tracing` package to use tracing and performance monitoring with the Sentry JavaScript SDKs. The `@sentry/tracing` package will be removed in a future major release, but can still be used in the meantime.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"postpublish": "lerna run --stream --concurrency 1 postpublish",
"test": "lerna run --ignore @sentry-internal/* test",
"test:unit": "lerna run --ignore @sentry-internal/* test:unit",
"test-ci-browser": "lerna run test --ignore \"@sentry/{node,opentelemetry-node,serverless,nextjs,remix,gatsby}\" --ignore @sentry-internal/*",
"test-ci-browser": "lerna run test --ignore \"@sentry/{node,opentelemetry-node,serverless,nextjs,remix,gatsby,sveltekit}\" --ignore @sentry-internal/*",
"test-ci-node": "ts-node ./scripts/node-unit-tests.ts",
"test:update-snapshots": "lerna run test:update-snapshots",
"yalc:publish": "lerna run yalc:publish"
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Router } from '@angular/router';
import { NavigationEnd, NavigationStart, ResolveEnd } from '@angular/router';
import { getCurrentHub, WINDOW } from '@sentry/browser';
import type { Span, Transaction, TransactionContext } from '@sentry/types';
import { logger, stripUrlQueryAndFragment, timestampWithMs } from '@sentry/utils';
import { logger, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/utils';
import type { Observable } from 'rxjs';
import { Subscription } from 'rxjs';
import { filter, tap } from 'rxjs/operators';
Expand Down Expand Up @@ -258,7 +258,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const originalMethod = descriptor.value;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
descriptor.value = function (...args: any[]): ReturnType<typeof originalMethod> {
const now = timestampWithMs();
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
activeTransaction.startChild({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ sentryTest('should normalize non-serializable context', async ({ getLocalTestPat

const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);

expect(eventData.contexts?.non_serializable).toMatchObject({});
expect(eventData.contexts?.non_serializable).toEqual('[HTMLElement: HTMLBodyElement]');
expect(eventData.message).toBe('non_serializable');
});
7 changes: 3 additions & 4 deletions packages/browser/src/stack-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function createFrame(filename: string, func: string, lineno?: number, colno?: nu

// Chromium based browsers: Chrome, Brave, new Opera, new Edge
const chromeRegex =
/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?(?:async )?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;

const chrome: StackLineParserFn = line => {
Expand Down Expand Up @@ -91,7 +91,7 @@ export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chrome];
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
// We need this specific case for now because we want no other regex to match.
const geckoREgex =
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;

const gecko: StackLineParserFn = line => {
Expand Down Expand Up @@ -123,8 +123,7 @@ const gecko: StackLineParserFn = line => {

export const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko];

const winjsRegex =
/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;

const winjs: StackLineParserFn = line => {
const parts = winjsRegex.exec(line);
Expand Down
35 changes: 35 additions & 0 deletions packages/browser/test/unit/tracekit/chromium.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,41 @@ describe('Tracekit - Chrome Tests', () => {
});
});

it('handles braces in urls', () => {
const CHROME_BRACES_URL = {
message: 'bad',
name: 'Error',
stack: `Error: bad
at something (http://localhost:5000/(some)/(thing)/index.html:20:16)
at more (http://localhost:5000/(some)/(thing)/index.html:25:7)`,
};

const ex = exceptionFromError(parser, CHROME_BRACES_URL);

expect(ex).toEqual({
value: 'bad',
type: 'Error',
stacktrace: {
frames: [
{
filename: 'http://localhost:5000/(some)/(thing)/index.html',
function: 'more',
lineno: 25,
colno: 7,
in_app: true,
},
{
filename: 'http://localhost:5000/(some)/(thing)/index.html',
function: 'something',
lineno: 20,
colno: 16,
in_app: true,
},
],
},
});
});

it('should drop frames that are over 1kb', () => {
const LONG_STR = 'A'.repeat(1040);

Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/tracing/idletransaction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-lines */
import type { TransactionContext } from '@sentry/types';
import { logger, timestampWithMs } from '@sentry/utils';
import { logger, timestampInSeconds } from '@sentry/utils';

import type { Hub } from '../hub';
import type { Span } from './span';
Expand Down Expand Up @@ -46,7 +46,7 @@ export class IdleTransactionSpanRecorder extends SpanRecorder {
if (span.spanId !== this.transactionSpanId) {
// We patch span.finish() to pop an activity after setting an endTimestamp.
span.finish = (endTimestamp?: number) => {
span.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : timestampWithMs();
span.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : timestampInSeconds();
this._popActivity(span.spanId);
};

Expand Down Expand Up @@ -128,7 +128,7 @@ export class IdleTransaction extends Transaction {
}

/** {@inheritDoc} */
public finish(endTimestamp: number = timestampWithMs()): string | undefined {
public finish(endTimestamp: number = timestampInSeconds()): string | undefined {
this._finished = true;
this.activities = {};

Expand Down Expand Up @@ -301,13 +301,13 @@ export class IdleTransaction extends Transaction {
}

if (Object.keys(this.activities).length === 0) {
const endTimestamp = timestampWithMs();
const endTimestamp = timestampInSeconds();
if (this._idleTimeoutCanceledPermanently) {
this._finishReason = IDLE_TRANSACTION_FINISH_REASONS[5];
this.finish(endTimestamp);
} else {
// We need to add the timeout here to have the real endtimestamp of the transaction
// Remember timestampWithMs is in seconds, timeout is in ms
// Remember timestampInSeconds is in seconds, timeout is in ms
this._restartIdleTimeout(endTimestamp + this._idleTimeout / 1000);
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/tracing/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
TraceContext,
Transaction,
} from '@sentry/types';
import { dropUndefinedKeys, logger, timestampWithMs, uuid4 } from '@sentry/utils';
import { dropUndefinedKeys, logger, timestampInSeconds, uuid4 } from '@sentry/utils';

/**
* Keeps track of finished spans for a given transaction
Expand Down Expand Up @@ -71,7 +71,7 @@ export class Span implements SpanInterface {
/**
* Timestamp in seconds when the span was created.
*/
public startTimestamp: number = timestampWithMs();
public startTimestamp: number = timestampInSeconds();

/**
* Timestamp in seconds when the span ended.
Expand Down Expand Up @@ -257,7 +257,7 @@ export class Span implements SpanInterface {
}
}

this.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : timestampWithMs();
this.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : timestampInSeconds();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/ember/addon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { macroCondition, isDevelopingApp, getOwnConfig } from '@embroider/macros
import { next } from '@ember/runloop';
import { assert, warn } from '@ember/debug';
import Ember from 'ember';
import { timestampWithMs, GLOBAL_OBJ } from '@sentry/utils';
import { timestampInSeconds, GLOBAL_OBJ } from '@sentry/utils';
import { GlobalConfig, OwnConfig } from './types';

function _getSentryInitConfig() {
Expand Down Expand Up @@ -68,7 +68,7 @@ export const getActiveTransaction = () => {

export const instrumentRoutePerformance = (BaseRoute: any) => {
const instrumentFunction = async (op: string, description: string, fn: Function, args: any) => {
const startTimestamp = timestampWithMs();
const startTimestamp = timestampInSeconds();
const result = await fn(...args);

const currentTransaction = getActiveTransaction();
Expand Down
12 changes: 6 additions & 6 deletions packages/ember/addon/instance-initializers/sentry-performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ExtendedBackburner } from '@sentry/ember/runloop';
import { Span, Transaction } from '@sentry/types';
import { EmberRunQueues } from '@ember/runloop/-private/types';
import { getActiveTransaction } from '..';
import { browserPerformanceTimeOrigin, GLOBAL_OBJ, timestampWithMs } from '@sentry/utils';
import { browserPerformanceTimeOrigin, GLOBAL_OBJ, timestampInSeconds } from '@sentry/utils';
import { macroCondition, isTesting, getOwnConfig } from '@embroider/macros';
import { EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
import RouterService from '@ember/routing/router-service';
Expand Down Expand Up @@ -182,14 +182,14 @@ function _instrumentEmberRunloop(config: EmberSentryConfig) {
if (currentQueueSpan) {
currentQueueSpan.finish();
}
currentQueueStart = timestampWithMs();
currentQueueStart = timestampInSeconds();

instrumentedEmberQueues.forEach(queue => {
scheduleOnce(queue, null, () => {
scheduleOnce(queue, null, () => {
// Process this queue using the end of the previous queue.
if (currentQueueStart) {
const now = timestampWithMs();
const now = timestampInSeconds();
const minQueueDuration = minimumRunloopQueueDuration ?? 5;

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
Expand All @@ -210,7 +210,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig) {
if (!stillActiveTransaction) {
return;
}
currentQueueStart = timestampWithMs();
currentQueueStart = timestampInSeconds();
});
});
});
Expand Down Expand Up @@ -244,7 +244,7 @@ interface RenderEntries {
function processComponentRenderBefore(payload: Payload, beforeEntries: RenderEntries) {
const info = {
payload,
now: timestampWithMs(),
now: timestampInSeconds(),
};
beforeEntries[payload.object] = info;
}
Expand All @@ -261,7 +261,7 @@ function processComponentRenderAfter(
return;
}

const now = timestampWithMs();
const now = timestampInSeconds();
const componentRenderDuration = now - begin.now;

if (componentRenderDuration * 1000 >= minComponentDuration) {
Expand Down
10 changes: 10 additions & 0 deletions packages/gatsby/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ module.exports = {
project: ['../../tsconfig.dev.json'],
},
},
{
files: ['./gatsby-browser.js'],
env: {
browser: true,
node: false,
},
parserOptions: {
sourceType: 'module',
},
},
],
extends: ['../../.eslintrc.js'],
};
Loading

0 comments on commit 1f34b16

Please sign in to comment.