Skip to content

Commit

Permalink
Merge pull request #14136 from getsentry/prepare-release/8.36.0
Browse files Browse the repository at this point in the history
meta(changelog): Update changelog for 8.36.0
  • Loading branch information
s1gr1d authored Oct 30, 2024
2 parents a9cedf9 + 09c8577 commit a566681
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 211 deletions.
14 changes: 0 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@

### Important Changes

- **feat(nuxt): Add Sentry Pinia plugin ([#14047](https://github.com/getsentry/sentry-javascript/pull/14047))**

The Nuxt SDK now allows you to track Pinia state for captured errors. To enable the Pinia plugin, set the `trackPinia` option to `true` in your client config:

```ts
// sentry.client.config.ts

Sentry.init({
trackPinia: true,
});
```

Read more about the Pinia plugin in the [Sentry Pinia Documentation](https://docs.sentry.io/platforms/javascript/guides/nuxt/features/pinia/).

- **feat(nextjs/vercel-edge/cloudflare): Switch to OTEL for performance monitoring ([#13889](https://github.com/getsentry/sentry-javascript/pull/13889))**

With this release, the Sentry Next.js, and Cloudflare SDKs will now capture performance data based on OpenTelemetry.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
imports: { autoImport: false },

modules: ['@pinia/nuxt', '@sentry/nuxt/module'],
modules: ['@sentry/nuxt/module'],

runtimeConfig: {
public: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"test:assert": "pnpm test"
},
"dependencies": {
"@pinia/nuxt": "^0.5.5",
"@sentry/nuxt": "latest || *",
"nuxt": "^3.13.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,4 @@ Sentry.init({
tunnel: `http://localhost:3031/`, // proxy server
tracesSampleRate: 1.0,
trackComponents: true,
trackPinia: {
actionTransformer: action => `Transformed: ${action}`,
stateTransformer: state => ({
transformed: true,
...state,
}),
},
});
43 changes: 0 additions & 43 deletions dev-packages/e2e-tests/test-applications/nuxt-4/stores/cart.ts

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions packages/aws-serverless/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ export function tryPatchHandler(taskRoot: string, handlerPath: string): void {
return;
}

// Check for prototype pollution
if (functionName === '__proto__' || functionName === 'constructor' || functionName === 'prototype') {
DEBUG_BUILD && logger.error(`Invalid handler name: ${functionName}`);
return;
}

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(mod as HandlerModule)[functionName!] = wrapHandler(obj);
}
Expand Down
15 changes: 2 additions & 13 deletions packages/nuxt/src/common/types.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import type { init as initNode } from '@sentry/node';
import type { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
import type { createSentryPiniaPlugin, init as initVue } from '@sentry/vue';
import type { init as initVue } from '@sentry/vue';

// Omitting 'app' as the Nuxt SDK will add the app instance in the client plugin (users do not have to provide this)
export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'> & {
/**
* Control if an existing Pinia store should be monitored.
* Set this to `true` to track with default options or provide your custom Pinia plugin options.
*
* This only works if "@pinia/nuxt" is added to the `modules` array.
*
* @default false
*/
trackPinia?: true | Parameters<typeof createSentryPiniaPlugin>[0];
};

export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'>;
export type SentryNuxtServerOptions = Omit<Parameters<typeof initNode>[0] & object, 'app'>;

type SourceMapsOptions = {
Expand Down
25 changes: 3 additions & 22 deletions packages/nuxt/src/runtime/plugins/sentry.client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getClient } from '@sentry/core';
import { consoleSandbox } from '@sentry/utils';
import { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from '@sentry/vue';
import { browserTracingIntegration, vueIntegration } from '@sentry/vue';
import { defineNuxtPlugin } from 'nuxt/app';
import { reportNuxtError } from '../utils';

Expand Down Expand Up @@ -35,36 +34,18 @@ export default defineNuxtPlugin({
name: 'sentry-client-integrations',
dependsOn: ['sentry-client-config'],
async setup(nuxtApp) {
const sentryClient = getClient();
const clientOptions = sentryClient && sentryClient.getOptions();

// This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside
// will get tree-shaken away
if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
const sentryClient = getClient();

if (sentryClient && '$router' in nuxtApp) {
sentryClient.addIntegration(
browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),
);
}
}

if (clientOptions && 'trackPinia' in clientOptions && clientOptions.trackPinia) {
if ('$pinia' in nuxtApp) {
(nuxtApp.$pinia as { use: (plugin: unknown) => void }).use(
// `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)
createSentryPiniaPlugin(clientOptions.trackPinia === true ? undefined : clientOptions.trackPinia),
);
} else {
clientOptions.debug &&
consoleSandbox(() => {
// eslint-disable-next-line no-console
console.warn(
'[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `"@pinia/nuxt"` to your modules array.',
);
});
}
}

nuxtApp.hook('app:created', vueApp => {
const sentryClient = getClient();

Expand Down
24 changes: 23 additions & 1 deletion packages/replay-internal/src/integration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { parseSampleRate } from '@sentry/core';
import type { BrowserClientReplayOptions, Client, Integration, IntegrationFn } from '@sentry/types';
import type {
BrowserClientReplayOptions,
Client,
Integration,
IntegrationFn,
ReplayRecordingMode,
} from '@sentry/types';
import { consoleSandbox, dropUndefinedKeys, isBrowser } from '@sentry/utils';

import {
Expand Down Expand Up @@ -297,6 +303,22 @@ export class Replay implements Integration {
return this._replay.getSessionId();
}

/**
* Get the current recording mode. This can be either `session` or `buffer`.
*
* `session`: Recording the whole session, sending it continuously
* `buffer`: Always keeping the last 60s of recording, requires:
* - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
* - or calling `flush()` to send the replay
*/
public getRecordingMode(): ReplayRecordingMode | undefined {
if (!this._replay || !this._replay.isEnabled()) {
return;
}

return this._replay.recordingMode;
}

/**
* Initializes replay.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/replay-internal/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class ReplayContainer implements ReplayContainerInterface {
public clickDetector: ClickDetector | undefined;

/**
* Recording can happen in one of three modes:
* Recording can happen in one of two modes:
* - session: Record the whole session, sending it continuously
* - buffer: Always keep the last 60s of recording, requires:
* - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
Expand Down
Loading

0 comments on commit a566681

Please sign in to comment.