payload icon indicating copy to clipboard operation
payload copied to clipboard

Sentry plugin + vite bundler crashing admin panel

Open razvan-soare opened this issue 1 year ago • 0 comments

Link to reproduction

https://github.com/razvan-soare/payload-sentry-bug-rep

Describe the Bug

Accessing admin panel page will only show a white screen and throw an error: Error: Dynamic require of "../../../../../../../@[email protected][email protected]_@[email protected][email protected]_typescript_dqcizn726yaibqtjwknlnrbrrm/node_modules/@payloadcms/plugin-sentry/dist/captureException" is not supported

Screenshot 2024-05-01 at 00 10 34

To Reproduce

Clone the repo i linked or:

Create new payload project:

npx create-payload-app@latest --use-pnpm
✔ Project name? … payload-sentry-bug-rep
✔ Choose project template › blank
✔ Select a database › PostgreSQL (beta)
✔ Enter PostgreSQL connection string … postgres://127.0.0.1:5432/payload-sentry-bug-rep

Install viteBundler and sentry

np i @payloadcms/bundler-vite
np i @payloadcms/plugin-sentry

Add them in payload.config.ts:

 admin: {
    bundler: viteBundler(),
  },
  plugins: [
    sentry({
      dsn: process.env.SENTRY_DSN,
      options: {
        init: {
          debug: true,
          environment: 'development',
          tracesSampleRate: 1.0,
        },
        requestHandler: {
          serverName: false,
          user: ['email'],
        },
        captureErrors: [400, 403, 404],
      },
    }),
  ],

Start the project and go check http://localhost:3000/admin/

Payload Version

"payload": "^2.0.0"

Adapters and Plugins

sentry-plugin, db-postgres, bundler-vite

razvan-soare avatar Apr 30 '24 23:04 razvan-soare