Skip to content

Problem with Nuxt source maps generation #15160

Closed

Description

@adiantek

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.51.0

Framework Version

Nuxt 3.15.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-11-01',
  devtools: { enabled: true },
  modules: ['@sentry/nuxt/module'],

  sentry: {
    sourceMapsUploadOptions: {
      org: 'adiantek',
      project: 'projectname',
      sourcemaps: {
        assets: ['./.output/public/**/*'],
        filesToDeleteAfterUpload: ['./.output/public/**/*.map']
      }
    }
  },

  sourcemap: {
    client: 'hidden'
  }
})

Steps to Reproduce

  1. npx nuxi@latest init projectname
  2. cd projectname
  3. npx nuxi@latest init projectname
  4. Modify config nuxt.config.ts to upload only generated .map (code from SDK Setup)
  5. npm run generate

Expected Result

Source maps from generated page should be uploaded. Sentry/nuxt uploads only from nuxt-server. sentry-rollup-plugin trying to upload source maps before Prerendering 3 initial routes with crawler.

Actual Result

> generate
> nuxt generate

Nuxt 3.15.2 with Nitro 2.10.4                                                                                                                                               nuxi 00:51:16
[Sentry] Enabled source map generation in the build options with nitro.rollupConfig.output.sourcemap: hidden.                                                                    00:51:18
[00:51:18] [Sentry] Disabled source map setting in the Nuxt config: nitro.rollupConfig.output.sourcemapExcludeSources. Source maps will include the actual code to be able to un-minify code snippets in Sentry.

 ERROR  [sentry-rollup-plugin] Info: Using environment variables configured in ".env.sentry-build-plugin".                                                                       00:51:18  


 ERROR  [sentry-rollup-plugin] Warning: No release name provided. Will not inject release. Please set the release.name option to identify your release.                          00:51:18  


 ERROR  [sentry-rollup-plugin] Warning: No release name provided. Will not create release. Please set the release.name option to identify your release.                          00:51:18  

ℹ Building for Nitro preset: static                                                                                                                                        nuxi 00:51:19
[sentry-vite-plugin] Info: Using environment variables configured in ".env.sentry-build-plugin".                                                                                 00:51:20
[sentry-vite-plugin] Warning: No release name provided. Will not inject release. Please set the release.name option to identify your release.                                    00:51:20
[sentry-vite-plugin] Warning: No release name provided. Will not create release. Please set the release.name option to identify your release.                                    00:51:20
ℹ Building client...                                                                                                                                                            00:51:20   
ℹ vite v6.0.11 building for production...                                                                                                                                       00:51:20
[sentry-vite-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
ℹ ✓ 358 modules transformed.                                                                                                                                                    00:51:23
computing gzip size (7)...[sentry-vite-plugin] Warning: Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.
ℹ .nuxt/dist/client/manifest.json                   1.33 kB │ gzip:  0.34 kB                                                                                                    00:51:24   
ℹ .nuxt/dist/client/_nuxt/error-500.dGVH929u.css    1.88 kB │ gzip:  0.72 kB                                                                                                    00:51:24   
ℹ .nuxt/dist/client/_nuxt/error-404.C3V-3Mc4.css    3.56 kB │ gzip:  1.10 kB                                                                                                    00:51:24   
ℹ .nuxt/dist/client/_nuxt/entry.ofCu9KLV.css       12.41 kB │ gzip:  2.57 kB                                                                                                    00:51:24   
ℹ .nuxt/dist/client/_nuxt/BdR5AMfq.js               3.71 kB │ gzip:  1.68 kB │ map:     5.27 kB                                                                                 00:51:24   
ℹ .nuxt/dist/client/_nuxt/Dhk-kskU.js               9.76 kB │ gzip:  3.93 kB │ map:    31.19 kB                                                                                 00:51:24   
ℹ .nuxt/dist/client/_nuxt/Lbg0X16a.js             160.24 kB │ gzip: 52.10 kB │ map:   699.75 kB                                                                                 00:51:24   
ℹ .nuxt/dist/client/_nuxt/IbnC22Td.js             306.59 kB │ gzip: 92.81 kB │ map: 1,566.64 kB                                                                                 00:51:24   
ℹ ✓ built in 3.54s                                                                                                                                                              00:51:24
✔ Client built in 3560ms                                                                                                                                                        00:51:24   
[sentry-vite-plugin] Info: Using environment variables configured in ".env.sentry-build-plugin".                                                                                 00:51:24  
[sentry-vite-plugin] Warning: No release name provided. Will not inject release. Please set the release.name option to identify your release.                                    00:51:24
[sentry-vite-plugin] Warning: No release name provided. Will not create release. Please set the release.name option to identify your release.                                    00:51:24
ℹ Building server...                                                                                                                                                            00:51:24   
ℹ vite v6.0.11 building SSR bundle for production...                                                                                                                            00:51:24   
[sentry-vite-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
ℹ ✓ 54 modules transformed.                                                                                                                                                     00:51:24
ℹ .nuxt/dist/server/_nuxt/entry-styles.D-XpIqgu.mjs             0.08 kB                                                                                                         00:51:25
ℹ .nuxt/dist/server/_nuxt/error-404-styles.BGub-NoM.mjs         0.08 kB                                                                                                         00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-500-styles.BmnNQC4v.mjs         0.08 kB                                                                                                         00:51:25   
ℹ .nuxt/dist/server/_nuxt/welcome-styles.Cqg1wF7g.mjs           0.15 kB                                                                                                         00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-404-styles.NlSTGTiZ.mjs         0.15 kB                                                                                                         00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-500-styles._pC1xW-P.mjs         0.15 kB                                                                                                         00:51:25   
ℹ .nuxt/dist/server/styles.mjs                                  1.11 kB                                                                                                         00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-500-styles-1.mjs-CJrjQwQj.js    2.51 kB │ map:   0.12 kB                                                                                        00:51:25   
ℹ .nuxt/dist/server/sentry.server.config.mjs                    4.11 kB │ map:   7.85 kB                                                                                        00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-404-styles-1.mjs-5Q3bo-Ck.js    4.18 kB │ map:   0.12 kB                                                                                        00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-500-D1U_AuVD.js                 5.06 kB │ map:   5.37 kB                                                                                        00:51:25   
ℹ .nuxt/dist/server/_nuxt/entry-styles-1.mjs-CvMDM5yB.js       13.07 kB │ map:   0.12 kB                                                                                        00:51:25   
ℹ .nuxt/dist/server/_nuxt/error-404-C-tWvrm_.js                14.65 kB │ map:  26.50 kB                                                                                        00:51:25
ℹ .nuxt/dist/server/server.mjs                                125.18 kB │ map: 182.60 kB                                                                                        00:51:25   
[sentry-vite-plugin] Warning: Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.
ℹ ✓ built in 785ms                                                                                                                                                              00:51:25
✔ Server built in 793ms                                                                                                                                                         00:51:25   
ℹ Initializing prerenderer                                                                                                                                                nitro 00:51:25

 ERROR  [sentry-rollup-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set options.telemetry to false.                           00:51:25  


[00:51:26]  WARN  "file:///C:/Users/barwn/git/test/projectname/node_modules/nuxt/dist/core/runtime/nitro/cache-driver.js" is imported by "virtual:#nitro-internal-virtual/storage", but could not be resolved – treating it as an external dependency.


 ERROR  [sentry-rollup-plugin] Warning: Didn't find any matching sources for debug ID upload. Please check the sourcemaps.assets option.                                         00:51:26  

ℹ Prerendering 3 initial routes with crawler                                                                                                                              nitro 00:51:26
  ├─ /404.html (50ms)                                                                                                                                                      nitro 00:51:26
  ├─ /200.html (49ms)                                                                                                                                                      nitro 00:51:26
  ├─ / (54ms)                                                                                                                                                              nitro 00:51:26  
  ├─ /_payload.json?114c8c55-6c3c-42cb-9f67-68710bbea16e (1ms) (skipped)                                                                                                   nitro 00:51:26  
  ├─ /_payload.json (2ms)                                                                                                                                                  nitro 00:51:26
ℹ Prerendered 4 routes in 1.732 seconds                                                                                                                                   nitro 00:51:26   
✔ Generated public .output/public                                                                                                                                         nitro 00:51:26
✔ You can preview this build using npx serve .output/public                                                                                                               nitro 00:51:26
✔ You can now deploy .output/public to any static hosting!  

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jan 24, 2025
  2. MirzaeiDev commented on Jan 26, 2025

    @MirzaeiDev

    I'm experiencing a similar issue after two days of investigating the Sentry documentation and code, with a slight difference:

    While you received a [sentry-rollup-plugin] warning in the terminal, I'm seeing the warning directly on the website.

    (I'm genuinely exhausted from adding source maps to Sentry and have basically given up at this point)

    Versions used:

    • Nuxt: ^3.15.2
    • @sentry/vite-plugin: ^3.1.0

    Attached are my configuration files:

    • sentry.client.config.ts
    import * as Sentry from '@sentry/nuxt';
    
    Sentry.init({
    	dsn: ' ***** **** ********* *****',
    
    	tracesSampleRate: 1.0,
    	integrations: [Sentry.piniaIntegration(usePinia())],
    	release: '3.25.4-alpha-5',
    	debug: true,
    
    	beforeSend(event) {
    		const indexStore = useIndexStore();
    
    		let initialState = {};
    		if (indexStore.shop_settings) {
    			initialState = {
    				shop_settings: indexStore.shop_settings,
    			};
    		}
    		// Add store data to extra context
    		event.extra = {
    			...event.extra,
    			...initialState,
    		};
    
    		return event;
    	},
    });
    
    • nuxt.config.ts
    
    // https://nuxt.com/docs/api/configuration/nuxt-config
    import vuetify from 'vite-plugin-vuetify';
    import { defineNuxtConfig } from 'nuxt/config';
    import { sentryVitePlugin } from '@sentry/vite-plugin';
    import env from './env.js';
    
    export default defineNuxtConfig({
    	ssr: false,
    
    	// @ts-ignore
    	vite: {
    		ssr: {
    			noExternal: ['vuetify'],
    		},
    		build: {
    			sourcemap: true,
    		},
    
    		plugins: [
    			sentryVitePlugin({
    				org: 'r******',
    				project: 'i******',
    				authToken: process.env.SENTRY_AUTH_TOKEN,
    				sourcemaps: {
    					filesToDeleteAfterUpload: ['.*/**/public/**/*.map'],
    				},
    			}),
    		],
    	},
    
    	sentry: {
    		sourceMapsUploadOptions: {
    			org: 'r******',
    			project: 'in******l',
    			authToken: process.env.SENTRY_AUTH_TOKEN,
    			sourcemaps: {
    				filesToDeleteAfterUpload: ['.*/**/public/**/*.map'],
    			},
    		},
    	},
    	sourcemap: {
    		server: false,
    		client: 'hidden',
    	},
    
    	router: {
    		options: {
    			strict: false,
    		},
    	},
    
    	runtimeConfig: {
    		public: {
    			baseURL: `https://${env.backend}/`,
    		},
    	},
    
    	imports: {
    		autoImport: true,
    	},
    	spaLoadingTemplate: 'app-loading.html',
    	css: ['~/assets/font-face.css', '~/assets/scss/app.scss'],
    
    	modules: [
    		// eslint-disable-next-line require-await
    		async (options, nuxt) => {
    			nuxt.hooks.hook('vite:extendConfig', (config) =>
    				// @ts-ignore
    				config.plugins?.push(
    					vuetify({
    						styles: {
    							configFile: 'assets/scss/variables.scss',
    						},
    					}),
    				),
    			);
    		},
    		'@nuxtjs/eslint-module',
    		'@pinia/nuxt',
    		'@nuxtjs/i18n',
    		'nuxt-socket-io',
    		'@sentry/nuxt/module',
    	],
    
    	// @ts-ignore
    	i18n: {
    		locales: [
    			// {
    			// 	code: 'en',
    			// 	file: 'en.ts',
    			// },
    			// { name: 'Farsi', code: 'fa', iso: 'fa-FA', file: 'fa.ts' },
    			{ code: 'fa', file: 'fa.ts' },
    		],
    		strategy: 'prefix_and_default',
    		langDir: 'locales/',
    		defaultLocale: 'fa',
    		baseUrl: '/',
    		lazy: true,
    	},
    
    	devtools: { enabled: true },
    
    	/** @type {import('nuxt-socket-io/io/types').NuxtSocketIoOptions} */
    	/** @type {import('nuxt-socket-io').NuxtSocketIoOptions} */
    	io: {
    		sockets: [{ name: '', url: env.socket, default: true }],
    	},
    
    	devServer: {
    		// host: 'http://192.168.1.20', // "http://localhost:3000"
    		port: 3017,
    	},
    
    	compatibilityDate: '2024-07-20',
    });
    

    When generating the project, I encountered this error:

    GENERATING ... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Source Map Upload Report
      Scripts
    
        ~/e2******3-0.js (no sourcemap ref, debug id e2827cd0-d******793)
    Source Map Upload Report
          - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/e2827******93-0.js)
      Scripts
        ~/e28******3-0.js (no sourcemap ref, debug id e28******93)
          - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/e******3-0.js)
    [sentry-vite-plugin] Info: Successfully uploaded source maps to Sentry
    [sentry-vite-plugin] Info: Successfully uploaded source maps to Sentry
    i ✓ built in 7.72s                                                                                          3:14:58 PM
    √ Server built in 7733ms                                                                                    3:14:58 PM
    i Initializing prerenderer                                                                            nitro 3:14:58 PM
    
    [3:14:58 PM]  ERROR  [sentry-rollup-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set options.telemetry to false.
    
    
    [3:15:00 PM]  WARN  "file://********NuxtPanel/node_modules/nuxt/dist/core/runtime/nitro/cache-driver.js" is imported by "virtual:#nitro-internal-virtual/storage", but could not be resolved – treating it as an external dependency.
    
    > Found 12 files                                                                                                                                                                                                                                                     
    > Analyzing 12 sources
    > Analyzing completed in 0.002s                                                                                                                                                                                                                                      
    > Adding source map references                                                                                                                                                                                                                                       
    > Bundling completed in 0.023s
    > Bundled 12 files for upload
    > Bundle ID: ***********
    > Optimizing completed in 0.006s
    > Uploading completed in 1.902s
    > Uploaded files to Sentry
    > Processing completed in 0.58s
    > File upload complete (processing pending on server)
    > Organization: r******
    > Project: ind******
    > Release: ********
    > Dist: None
    > Upload type: artifact bundle
    
    Source Map Upload Report
      Scripts
        ~/1858******-0.js (sourcemap at 18586******-0.js.map, debug id 18*******8)
        ~/1f2******58-1.js (sourcemap at 1f27******58-1.js.map, debug id 1f27a9******8)
        ~/4c8******-2.js (sourcemap at 4c8******b-2.js.map, debug id 4c867f******b)
        ~/9b******8bc-5.js (sourcemap at 9******bc-5.js.map, debug id 9b6c******c)
        ~/c5a******-3.js (sourcemap at c******-3.js.map, debug id c5******92)
        ~/d******1e9c-4.js (sourcemap at d4******c-4.js.map, debug id d4******9c)
      Source Maps
        ~/18******18-0.js.map (debug id 18******8)
        ~/1******d58-1.js.map (debug id 1f2******58)
        ~/4c8******b-2.js.map (debug id 4c******b)
        ~/9b6******048bc-5.js.map (debug id 9b******c)
        ~/c5a******92-3.js.map (debug id c5******92)
        ~/d43******21e9c-4.js.map (debug id d4******9c)
    
     ERROR  [sentry-rollup-plugin] Info: Successfully uploaded source maps to Sentry                            3:15:06 PM
    
    i Prerendering 163 initial routes with crawler                                                        nitro 3:15:06 PM
      ├─ /browse (115ms)                                                                                  nitro 3:15:06 PM
      ├─ /fa (115ms)                                                                                      nitro 3:15:06 PM
      ├─ /login (117ms)                                                                                   nitro 3:15:06 PM
      ├─ /fa/login (117ms)                                                                                nitro 3:15:06 PM
      ├─ / (115ms)                                                
    
     AND OTHER >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    

    here is warning "Missing source map with a matching Debug ID" in site
    Image

    Hope this helps in troubleshooting the issue.

  3. andreiborza commented on Jan 27, 2025

    @andreiborza
    Member

    Hi @adiantek @MirzaeiDev, thanks for filing this.

    I just had a look at it seems like setting the assets path to ./.output/.... ends up not working correctly. If you leave assets out completely, the plugin will detect the sourcemaps and sourcefiles correctly. Alternatively, setting ./.*/... also seems to work in case you want to restrict deeper paths.

    We'll have to dig deeper into why this is the case tho.

    @MirzaeiDev you shouldn't have to add the sentryVitePlugin manually, the SDK already takes care setting it up. Having two might interfere with each other. Could you try removing it?

  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jan 27, 2025
  5. Azirafel17 commented on Feb 19, 2025

    @Azirafel17

    Hi,
    A similar problem

    My sentry.client.config.ts file
    Image

    My package.json
    Image

    My nuxt.config.ts file
    The release key is used in unstable_sentryBundlerPluginOptions, because without it, the release field is not filled in when transferring sourcemap.
    Image

    sourcemap uploaded to Sentry
    Image

    But when a problem occurs, sourcemap are not matched.

    Image

    Please, what is the problem, how to make the sourcemap work?

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Feb 19, 2025
  7. s1gr1d commented on Feb 19, 2025

    @s1gr1d
    Member

    @Azirafel17 Thanks for sharing the screenshots. Can you share the link to the Sentry event? If you don't want to post it here, you can send it to me via mail (without whitespaces): sigrid . huemer [at] sentry . io

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Feb 19, 2025
  9. Azirafel17 commented on Feb 20, 2025

    @Azirafel17

    Hello, Sigrid.
    Thanks for the quick response.
    I have Sentry deployed as selfhost, so I posted JSON here. If you need anything else, please let us know.

    event_9147df6c70eb4d41bb4ab6b11b0a86cd.json

  10. 66 remaining items

  11. getsantry commented on Apr 1, 2025

    @getsantry

    This issue has gone three weeks without activity. In another week, I will close it.

    But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


    "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

  12. changed the title [-]nuxt generate & upload source maps[/-] [+]Problem with Nuxt source maps generation[/+] on Apr 8, 2025
  13. mydea commented on Apr 8, 2025

    @mydea
    Member

    Why was this issue closed?

    This issue hasn't been touched recently and no longer seems relevant.
    Hence, we're closing it to maintain a clean and transparent backlog.

    Please feel free to leave a comment if you think this issue should be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions