---
title: "Server-Side Installation"
description: "Learn how the Nuxt SDK initializes Sentry on the server side, and how to upgrade to version 11."
url: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/
---

# Server-Side Installation | Sentry for Nuxt

This page applies to SDK version `11.0.0` and above. Version 10 and earlier need the Node `--import` flag. For those versions, see the [installation methods for version 10](https://docs.sentry.io/platforms/javascript/guides/nuxt/install__v10.x).

## [How the SDK Initializes on the Server](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#how-the-sdk-initializes-on-the-server)

The SDK bundles your `sentry.server.config.ts` file into the Nitro server build. A Nitro plugin that the SDK generates imports this file, so `Sentry.init()` runs when the server starts.

The SDK adds its instrumentation at build time. Because of this, Sentry doesn't have to load before the rest of your application. You start your application as usual, in production and in development mode, and on hosts where you can't set Node CLI flags, such as Vercel or Netlify.

To confirm that the SDK bundled your server config, enable `debug` in the `sentry` options of your `nuxt.config.ts`. The SDK then prints a message during the build.

### [Development Mode](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#development-mode)

In `nuxt dev`, spans from some libraries can be missing. Errors and request traces always work, and production builds are not affected.

In a production build, Sentry prepares your libraries for tracing while Nuxt builds your app. The dev server has no build step, so Sentry can only prepare a library that loads after Sentry starts. Nuxt loads most libraries before that, for example your database client.

Some libraries send tracing data on their own through [tracing channels](https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel). Sentry always picks up this data, also in development mode. This includes recent versions of `ioredis`, `redis`, `mysql2`, and `mongoose`.

To see all spans, test with a production build: run `nuxi build`, then start your app.

### [Prerendering](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#prerendering)

The SDK doesn't initialize Sentry while Nitro prerenders your pages at build time. As a result, builds don't send events to Sentry, and prerendered HTML doesn't contain trace meta tags.

### [Cloudflare](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#cloudflare)

With a Cloudflare Nitro preset, the SDK doesn't use `sentry.server.config.ts`. Set up the SDK with the [Cloudflare Nitro plugin](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/nuxt.md) instead.

## [Upgrade to SDK Version 11](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#upgrade-to-sdk-version-11)

### [Remove the `--import` Flag](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#remove-the---import-flag)

Remove the `--import` flag from the command that starts your production build:

```bash
# Before
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs

# After
node .output/server/index.mjs
```

Do the same in development mode:

```bash
# Before
NODE_OPTIONS='--import ./.nuxt/dev/sentry.server.config.mjs' nuxt dev

# After
nuxt dev
```

Also remove the flag from the `NODE_OPTIONS` environment variable of your hosting provider, if you set it there.

Existing start commands continue to work. The SDK still writes a file to `.output/server/sentry.server.config.mjs`, but this file only prints a reminder to remove the flag.

If you preload your own file that calls `Sentry.init()`, that call initializes the SDK. The SDK then skips the bundled initialization and prints a notice.

### [Deprecated Options](https://docs.sentry.io/platforms/javascript/guides/nuxt/install.md#deprecated-options)

Because a preload is no longer necessary, the following `sentry` module options are deprecated. They continue to work in version 11 and will be removed in the next major version.

| Option                                                  | Replacement                                 |
| ------------------------------------------------------- | ------------------------------------------- |
| `autoInjectServerSentry: "top-level-import"`            | Remove the option. The default replaces it. |
| `autoInjectServerSentry: "experimental_dynamic-import"` | Remove the option. The default replaces it. |
| `experimental_entrypointWrappedFunctions`               | Remove the option. It has no replacement.   |

If you set `autoInjectServerSentry`, the SDK uses that mode instead of the bundled initialization and prints a deprecation warning during the build. Remove the option to use the bundled initialization:

```typescript
// Before
export default defineNuxtConfig({
  modules: ["@sentry/nuxt/module"],
  sentry: {
    autoInjectServerSentry: "top-level-import",
  },
});

// After
export default defineNuxtConfig({
  modules: ["@sentry/nuxt/module"],
});
```

## Pages in this section

- [--import CLI flag (default)](https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import__v10.x.md)
- [Limited Server Tracing](https://docs.sentry.io/platforms/javascript/guides/nuxt/install/limited-server-tracing__v10.x.md)
- [Dynamic Import (experimental)](https://docs.sentry.io/platforms/javascript/guides/nuxt/install/dynamic-import__v10.x.md)
