getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8.01k stars 1.58k forks source link

ERROR RollupError: [plugin impound] Importing directly from module entry-points is not allowed. [importing @sentry/nuxt from sentry.server.config.ts] #14333

Closed larsvdd closed 4 days ago

larsvdd commented 4 days ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

8.38.0

Framework Version

Nuxt 3.14.159

Link to Sentry event

No response

Reproduction Example/SDK Setup

sentry.server.config.ts

import * as Sentry from "@sentry/nuxt";

if (process.env.SENTRY_DSN) {
    Sentry.init({
        dsn: process.env.SENTRY_DSN,
        // Tracing
        // We recommend adjusting this value in production, or using a tracesSampler for finer control.
        tracesSampleRate: 1.0, // Capture 100% of the transactions
    });
}

sentry.client.config.ts

import { useRuntimeConfig } from "#imports";
import * as Sentry from "@sentry/nuxt";

Sentry.init({
    dsn: useRuntimeConfig().public.sentry.dsn,
    integrations: [Sentry.replayIntegration()],
    tracesSampleRate: 1.0,
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1.0,
});

modules in nuxt.config.ts

modules: [
        "@sentry/nuxt/module",
    ],
sentry: {
        dsn: process.env.SENTRY_DSN,
        sourcemap: {
            client: true,
            server: true,
        },
        sourceMapsUploadOptions: {
            org: "dutch-beauty-group",
            project: "vue-storefront",
            authToken: process.env.SENTRY_AUTH_TOKEN,
        },
    },

Steps to Reproduce

I followed the installation steps but I get a: [nitro] ERROR RollupError: [plugin impound] Importing directly from module entry-points is not allowed. [importing @sentry/nuxt from sentry.server.config.ts]

And client side: [plugin:vite:import-analysis] Importing directly from module entry-points is not allowed. [importing@sentry/nuxtfromsentry.client.config.ts]

Expected Result

A working environment with Sentry installed 😅

Actual Result

Nuxt not starting...

Image

andreiborza commented 4 days ago

Hi @larsvdd, thanks for writing in.

Could you please provide a reproduction repo? I just tried this out in a fresh project and didn't run into this.

larsvdd commented 4 days ago

Can't seem to reproduce it in Stackblitz or Bolt. 🤔 Could the issue be that I'm building with bun?

bun run dev or bun run build

andreiborza commented 4 days ago

@larsvdd I just tried it with bun install, bun rnu build and bun run preview and had no issues. It doesn't have to be a Stackblitz, a Github repo would suffice.

larsvdd commented 4 days ago

@andreiborza Sorry, seems like there were some problems with my Dockerfiles. Works as expected now 🙏🏼