Skip to content

Commit

Permalink
Merge pull request #12002 from getsentry/prepare-release/8.0.0
Browse files Browse the repository at this point in the history
Add Changelog entry for 8.0.0
  • Loading branch information
Lms24 committed May 13, 2024
2 parents e5b295e + 2e08b05 commit 19648c5
Show file tree
Hide file tree
Showing 27 changed files with 637 additions and 477 deletions.
116 changes: 115 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,120 @@

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

## 8.0.0

The Sentry JS SDK team is proud to announce the release of version `8.0.0` of Sentry's JavaScript SDKs - it's been a
long time coming! Thanks to everyone for your patience and a special shout out to the brave souls testing preview builds
and reporting issues - we appreciate your support!

---

### How to Upgrade to Version 8:

We recommend reading the
[migration guide docs](https://docs.sentry.io/platforms/javascript/migration/v7-to-v8/#migration-codemod) to find out
how to address any breaking changes in your code for your specific platform or framework.

To automate upgrading to v8 as much as possible, use our migration codemod `@sentry/migr8`:

```sh
npx @sentry/migr8@latest
```

All deprecations from the v7 cycle, with the exception of `getCurrentHub()`, have been removed and can no longer be used
in v8. If you have an advanced Sentry SDK setup, we additionally recommend reading the
[in-depth migration guide](./MIGRATION.md) in our repo which highlights all changes with additional details and
information.

The rest of this changelog highlights the most important (breaking) changes and links to more detailed information.

### Version Support

With v8, we dropped support for several old runtimes and browsers

**Node SDKs:** The Sentry JavaScript SDK v8 now supports **Node.js 14.8.0 or higher**. This applies to `@sentry/node`
and all of our node-based server-side sdks (`@sentry/nextjs`, `@sentry/remix`, etc.). Furthermore, version 8 now ships
with full support for ESM-based node apps using **Node.js 18.19.0 or higher**.

**Browser SDKs:** The browser SDKs now require
[**ES2018+**](https://caniuse.com/?feats=mdn-javascript_builtins_regexp_dotall,js-regexp-lookbehind,mdn-javascript_builtins_regexp_named_capture_groups,mdn-javascript_builtins_regexp_property_escapes,mdn-javascript_builtins_symbol_asynciterator,mdn-javascript_functions_method_definitions_async_generator_methods,mdn-javascript_grammar_template_literals_template_literal_revision,mdn-javascript_operators_destructuring_rest_in_objects,mdn-javascript_operators_destructuring_rest_in_arrays,promise-finally)
compatible browsers. New minimum browser versions:

- Chrome 63
- Edge 79
- Safari/iOS Safari 12
- Firefox 58
- Opera 50
- Samsung Internet 8.2

For more details, please see the
[version support section in our migration guide](./MIGRATION.md#1-version-support-changes).

### Initializing Server-side SDKs (Node, Bun, Deno, Serverless):

In v8, we support a lot more node-based packages than before. In order to ensure auto-instrumentation works, the SDK now
needs to be imported and initialized before any other import in your code.

We recommend creating a new file (e.g. `instrumentation.js`) to import and initialize the SDK. Then, import the file on
top of your entry file or detailed instructions, check our updated SDK setup docs
[initializing the SDK in v8](https://docs.sentry.io/platforms/javascript/guides/node/).

### Performance Monitoring Changes

The API around performance monitoring and tracing has been streamlined, and we've added support for more integrations
out of the box.

- [Performance Monitoring API](./MIGRATION.md#performance-monitoring-api)
- [Performance Monitoring Integrations](./MIGRATION.md#performance-monitoring-integrations)

### Functional Integrations

Integrations are now simple functions instead of classes. Class-based integrations
[have been removed](./MIGRATION.md#removal-of-class-based-integrations):

```javascript
// old (v7)
Sentry.init({
integrations: [new Sentry.BrowserTracing()],
});

// new (v8)
Sentry.init({
integrations: [Sentry.browserTracingIntegration()],
});
```

### Package removal

The following packages have been removed or replaced and will no longer be published:

- [`@sentry/hub`](./MIGRATION.md#sentryhub)
- [`@sentry/tracing`](./MIGRATION.md#sentrytracing)
- [`@sentry/integrations`](./MIGRATION.md#sentryintegrations)
- [`@sentry/serverless`](./MIGRATION.md#sentryserverless)
- [`@sentry/replay`](./MIGRATION.md#sentryreplay)

### Changes since `8.0.0-rc.3`

- **feat(nextjs): Remove `transpileClientSDK` (#11978)**

As we are dropping support for Internet Explorer 11 and other other older browser versions wih version `8.0.0`, we are
also removing the `transpileClientSDK` option from the Next.js SDK. If you need to support these browser versions,
please configure Webpack and Next.js to down-compile the SDK.

- **feat(serverless): Do not include performance integrations by default (#11998)**

To keep Lambda bundle size reasonable, the SDK no longer ships with all performance (database) integrations by
default. Add the Sentry integrations of the databases and other tools you're using manually to your `Sentry.init` call
by following
[this guide](https://docs.sentry.io/platforms/javascript/configuration/integrations/#modifying-default-integrations).
Note that this change does not apply if you use the SDK with the Sentry AWS Lambda layer.

- feat(feedback): Simplify public css configuration for feedback (#11985)
- fix(feedback): Check for empty user (#11993)
- fix(replay): Fix type for `replayCanvasIntegration` (#11995)
- fix(replay): Fix user activity not being updated in `start()` (#12001)

## 8.0.0-rc.3

### Important Changes
Expand Down Expand Up @@ -304,7 +418,7 @@ The following packages will no longer be published

### Initializing Server-side SDKs (Node, Bun, Next.js, SvelteKit, Astro, Remix):

Initializing the SDKs on the server-side has been simplified. See more details in our migration docs about
Initializing the SDKs on the server-side has been simplified. More details in our migration docs about
[initializing the SDK in v8](./MIGRATION.md/#initializing-the-node-sdk).

### Performance Monitoring Changes
Expand Down
19 changes: 16 additions & 3 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ stable release of `8.x` comes out).

## 1. Version Support changes:

**Node.js**: We now official support Node 14.18+ for our CJS package, and Node 18.8+ for our ESM package. This applies
to `@sentry/node` and all of our node-based server-side sdks (`@sentry/nextjs`, `@sentry/serverless`, etc.). We no
longer test against Node 8, 10, or 12 and cannot guarantee that the SDK will work as expected on these versions.
**Node.js**: We now officially support Node 14.18+ for our CJS package, and Node 18.19.1+ for our ESM package. This
applies to `@sentry/node` and all of our node-based server-side sdks (`@sentry/nextjs`, `@sentry/serverless`, etc.). We
no longer test against Node 8, 10, or 12 and cannot guarantee that the SDK will work as expected on these versions.

**Browser**: Our browser SDKs (`@sentry/browser`, `@sentry/react`, `@sentry/vue`, etc.) now require ES2018+ compatible
browsers. This means that we no longer support IE11 (end of an era). This also means that the Browser SDK requires the
Expand Down Expand Up @@ -866,6 +866,12 @@ in order to inject the `sentry.(server|edge).config.ts` files into the server-si
possible in the future, we are doing ourselves a favor and doing things the way Next.js intends us to do them -
hopefully reducing bugs and jank.

#### Removal of `transpileClientSDK`

Since we are dropping support for Internet Explorer 11 and other other older browser versions, we are also removing the
`transpileClientSDK` option from the Next.js SDK. If you need to support these browser versions, please configure
Webpack and Next.js to down-compile the SDK.

### Astro SDK

- [Removal of `trackHeaders` option for Astro middleware](./MIGRATION.md#removal-of-trackheaders-option-for-astro-middleware)
Expand Down Expand Up @@ -1283,6 +1289,13 @@ export class HeaderComponent {
}
```

# Upgrading Sentry Feedback (beta, 7.x to 8.0)

For details on upgrading Feedback from the beta 7.x to the release 8.x version, please view the
[dedicated Feedback MIGRATION docs](./docs/migration/feedback.md).

---

# Deprecations in 7.x

You can use the **Experimental** [@sentry/migr8](https://www.npmjs.com/package/@sentry/migr8) to automatically update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const NODE_EXPORTS_IGNORE = [
'__esModule',
// Only required from the Node package
'setNodeAsyncContextStrategy',
'getDefaultIntegrationsWithoutPerformance',
];

const nodeExports = Object.keys(SentryNode).filter(e => !NODE_EXPORTS_IGNORE.includes(e));
Expand Down
149 changes: 149 additions & 0 deletions docs/migration/feedback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# End of Feedback Beta

With the release of 8.0.0, Sentry Feedback is now out of Beta. This means that the usual stabilty guarantees apply.

Feedback 8.0.0 requires server version 24.4.2 and above.

Because of experimentation and rapid iteration, during the Beta period some bugs and problems came up which have since
been fixed/improved, as well as API's which have been streamlined and changed.

Below you can find a list of relevant feedback changes and issues that have been made from 7.x to 8.0.0.

## Upgrading Feedback from 7.x to 8.0.0

We have streamlined the interface for interacting with the Feedback widget. Below is a list of public functions that
existed in 7.x and a description of how they have changed in v8.

| Method Name | Replacement | Notes |
| ------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Sentry.getClient<BrowserClient>()?.getIntegration(Feedback)` | `const feedback = Sentry.getFeedback()` | Get a type-safe reference to the configured feedbackIntegration instance. |
| `feedback.getWidget()` | `const widget = feedback.createWidget(); widget.appendToDom()` | The SDK no longer maintains a stack of form instances. If you call `createWidget()` a new widget will be inserted into the DOM and an `ActorComponent` returned allows you control over the lifecycle of the widget. |
| `feedback.openDialog()` | `widget.open()` | Make the form inside the widget visible. |
| `feedback.closeDialog()` | `widget.close()` | Make the form inside the widget hidden in the page. Success/Error messages will still be rendered and will hide themselves if the form was recently submitted. |
| `feedback.removeWidget()` | `widget.removeFromDom()` | Remove the form and widget instance from the page. After calling this `widget.el.parentNode` will be set to null. |
| `feedback.attachTo()` | `const unsubscribe = feedback.attachTo(myButtonElem)` | The `attachTo()` method will create an onClick event listener to your html element that calls `appendToDom()` and `open()`. It returns a callback to remove the event listener. |
| - | `const form = await feedback.createForm()` | A new method `createForm()`, used internally by `createWidget()` and `attachTo()`, returns a `Promise<FeedbackDialog>` so you can control showing and hiding of the feedback form directly. |

### API Examples

#### Auto injecting Feedback

The easiest way to get setup is to auto-inject the feedback widget. This will create a floating button which opens the
feedback form.

In your SDK setup:

```javascript
Sentry.init({
integrations: [
feedbackIntegration({
autoInject: true,
}),
],
});
```

`autoInject: true` is the default value.

#### Attaching feedback to your own button

If you don't want to have a floating button to trigger the feedback form, you can attach the form to your own DOM
element instead.

First, get a reference to the feedback integration instance:

```javascript
// Option 1: Keep a reference when you setup the sdk:
const feedbackInstance = feedbackIntegration();
Sentry.init({
integrations: [feedbackInstance],
});

// Option 2: Get a reference from the SDK client
const feedbackInstance = getFeedback();
```

Next, call `attachTo()`

```javascript
const myButton = document.getElementById('my-button');
const unsubscribe = feedbackInstance.attachTo(myButton);
```

This will insert the form into the DOM and show/hide it when the button is clicked.

Later, if `my-button` is removed from the page be sure to call `unsubscribe()` or `feedbackInstance.remove()` to cleanup
the event listeners.

#### Manually managing show/hide state and adding/remove the form from the DOM.

You can manually add/remove the widget from the page, and control when it's shown/hidden by calling the lifecycle
methods directly.

For example, `attachTo()` is a convenience wrapper over the lifecycle methods. You could re-implement it like this:

```javascript
function attachTo(button: HTMLElement) {
const handleClick = () => {
const widget = feedbackInstance.createWidget({
onFormClose: () => {
widget.close();
},
onFormSubmited: () => {
widget.removeFromDom();
}
});
widget.appendToDom();
widget.open();
};

button.addEventListener('click', handleClick);
return () => {
button.removeEventListener('click', handleClick)
}
}
```

Alternatively you can call `createForm()` and control the form directly:

```javascript
const formPromise = feedbackInstance.createForm();

// Automatically insert and open the dialog after 5 seconds
// then close and remove it after another 10 seconds
setTimeout(() => {
const form = await formPromise;
form.appendToDom();
form.open();

setTimeout(() => {
form.close();
form.removeFromDom();
}, 10_000);
}, 5_000);
```

## Config changes in v8

Added new configuration values

| Field Name | Type | Description |
| ------------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enableScreenshot` | `boolean` | Default: true. Enable this option to allow a user to choose to include a screenshot of the webpage with their feedback submission. The user option is not supported on mobile browsers and will have no effect there. |
| `onFormSubmitted` | `() => void` | Callback whenever the feedback form is submitted, but before success/failure is returned. |

Some new configuration values have been added & changed so you can tweak instructions, or translate labels for your
users.

| Old Name | New Name | Default Value |
| ---------------- | ----------------------- | ------------------------------ |
| `buttonLabel` | `triggerLabel` | `"Report a bug"` |
| `isRequiredText` | `isRequiredLabel` | `"(required)"` |
| - | `addScreenshotLabel` | `"Add a screenshot"` |
| - | `removeScreenshotLabel` | `"Remove Screenshot"` |
| - | `confirmButtonLabel` | `"Confirm"` |
| - | `successMessageText` | `"Thank you for your report!"` |

Some theme/color configuration values have been added & changed to make it easier to style the widget. Refer to the
[Feedback Configuration docs](https://docs.sentry.io/platforms/javascript/user-feedback/configuration/#user-feedback-widget)
to see the supported fields and their default values.
2 changes: 1 addition & 1 deletion docs/v8-initializing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In an environment with multiple execution contexts (e.g. Node), you can setup mu
different contexts, like this:

```js
import * as Sentry from '@sentry/browser';
import * as Sentry from '@sentry/node';

// Sets up the _default_ client
Sentry.init({
Expand Down

0 comments on commit 19648c5

Please sign in to comment.