Skip to content

When sentry.client.config.js is present, Astro builds fail. #17533

@aozou99

Description

@aozou99

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/astro

SDK Version

10.9.0

Framework Version

[email protected] @astrojs/node9.4.3

Link to Sentry event

No response

Reproduction Example/SDK Setup

astro.config.mjs

// @ts-check
import { defineConfig } from "astro/config";
import node from "@astrojs/node";

import sentry from "@sentry/astro";

// https://astro.build/config
export default defineConfig({
  output: "server",
  adapter: node({
    mode: "standalone",
  }),
  integrations: [
    sentry({
      sourceMapsUploadOptions: {
        project: __YOUR_PROJECT__,
        org: __YOUR_ORG__",
        authToken: __YOUR_TOKEN__
      },
    }),
  ],
  vite: {
    build: {
      rollupOptions: {
        external: ["fsevents"],  //  Added fsevents because an error occurred when build.
      },
    },
  },
});

sentry.client.config.js

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

Sentry.init({
  dsn: __YOUE_DSN__,

  integrations: [],
});

Steps to Reproduce

  1. npm create astro@latest
  2. npx astro add @sentry/astro
  3. npm i @astrojs/node
  4. add sentry.client.config.js & edit astro.config.mjs
  5. npm run build

Expected Result

Build success

Actual Result

05:35:43 [ERROR] [vite] ✗ Build failed in 3.13s
node_modules/rollup/dist/es/shared/parseAst.js (11:27): "basename" is not exported by "__vite-browser-external", imported by "node_modules/rollup/dist/es/shared/parseAst.js".
file: /workspaces/test/node_modules/rollup/dist/es/shared/parseAst.js:11:27

 9: */
10: import { parse, parseAsync } from '../../native.js';
11: import { resolve, dirname, basename, extname } from 'node:path';
                               ^
12: 
13: // This file is generated by scripts/generate-node-types.js.

Deleting sentry.client.config.js allows the build to succeed normally.
However, client-side errors like the one in the sample did not appear to be sent to Sentry.

src/pages/index.astro

<button onclick="throw new Error('This is a test error')">Throw test error</button>

Metadata

Metadata

Assignees

Labels

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions