getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
141 stars 36 forks source link

Sourcemap for XXX points to missing source files for node modules warning #606

Closed isAlmogK closed 2 months ago

isAlmogK commented 2 months ago

Environment

Web, Svelte, Vite, @sentry/vite-plugin

"@sveltejs/vite-plugin-svelte": "^1.1.0",

I treid to hide this

sentryVitePlugin({
        org: 'dogbase',
        project: 'dogbase-production',
        authToken: env.VITE_APP_SENTRY_AUTH_TOKEN,
                silent: true, // This will suppress all logs from the Sentry plugin
        errorHandler: (error) => {
          console.warn('Sentry Plugin Error:', error);
          // This will log the error as a warning but allow the build to continue
        },
        sourcemaps: {
          // Specify which build artifacts should be uploaded to Sentry
          assets: './dist/**',
          ignore: ['./node_modules/**'],
        },
      }),

Expected Result

Not see the followig

Image

Actual Result

What actually happened. Maybe a screenshot/recording? Maybe some logs?

chargome commented 2 months ago

Hey @isAlmogK, thanks for reaching out. Can you share your full vite.config.ts|js?

isAlmogK commented 2 months ago

@chargome here

import { defineConfig, loadEnv } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import './src/vite-env.d'

export default defineConfig(({ mode }) => {
  // Load environment variables based on the current mode
  const env = loadEnv(mode, process.cwd(), '')

  return {
    build: {
      sourcemap: true, // Source map generation must be turned on
      target: 'ESNext',

    },
    plugins: [
            //warningHandlerPlugin(),
      svelte(),
      sentryVitePlugin({
        org: env.VITE_APP_SENTRY_ORG,
        project: env.VITE_APP_SENTRY_PROJECT,
        authToken: env.VITE_APP_SENTRY_AUTH_TOKEN,
                //silent: true, // This will suppress all logs from the Sentry plugin
        /*
                errorHandler: (error) => {
          console.warn('Sentry Plugin Error:', error);
          // This will log the error as a warning but allow the build to continue
        },
        sourcemaps: {
          // Specify which build artifacts should be uploaded to Sentry
          assets: './dist/**',
          ignore: ['./node_modules/**'],
        },
                */
      }),
    ],
    optimizeDeps: { exclude: ['svelte-navigator'] },
  }
})
lforst commented 2 months ago

Hi, can you elaborate why you relate this issue to Sentry? :)

I don't think the error message comes from anything relating to us: https://github.com/search?type=code&q=%22points+to+missing+source+files%22+org%3Agetsentry+

I think it's vite: https://github.com/vitejs/vite/blob/adf379963a2c21544b244c04b664b788bc9cb7a5/packages/vite/src/node/server/sourcemap.ts#L81

isAlmogK commented 2 months ago

Yes your correct sorry about that