Skip to content

authToken from nuxt.config.ts not read during Docker build - source maps not uploaded #19098

@SwartZCoding

Description

@SwartZCoding

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

10.38.0

Framework Version

Nuxt 4.1.3, Vue 3.5.22

Link to Sentry event

N/A (source maps not uploaded)

Reproduction Example/SDK Setup

nuxt.config.ts:

  modules: ['@sentry/nuxt/module'],                                                                                                                                                                                               
                                                                                                                                                                                                                                  
  sourcemap: {                                                                                                                                                                                                                    
    client: 'hidden',                                                                                                                                                                                                             
    server: false,                                                                                                                                                                                                                
  },                                                                                                                                                                                                                              
                                                                                                                                                                                                                                  
  sentry: {                                                                                                                                                                                                                       
    org: 'my-org',                                                                                                                                                                                                                
    project: 'my-project',                                                                                                                                                                                                        
    authToken: process.env.SENTRY_AUTH_TOKEN,                                                                                                                                                                                     
    sourcemaps: {                                                                                                                                                                                                                 
      filesToDeleteAfterUpload: [                                                                                                                                                                                                 
        '.output/**/*.map',                                                                                                                                                                                                       
        '.output/public/**/*.map',                                                                                                                                                                                                
      ],                                                                                                                                                                                                                          
    },                                                                                                                                                                                                                            
  },                                                                                                                                                                                                                              
})```

sentry.client.config.ts:                                                                                                                                                                                                          
```import * as Sentry from "@sentry/nuxt";                                                                                                                                                                                           
                                                                                                                                                                                                                                  
Sentry.init({                                                                                                                                                                                                                     
  dsn: "https://xxx@xxx.ingest.us.sentry.io/xxx",                                                                                                                                                                                 
  tracesSampleRate: 1.0,                                                                                                                                                                                                          
  enableLogs: true,                                                                                                                                                                                                               
  sendDefaultPii: true,                                                                                                                                                                                                           
  debug: false,                                                                                                                                                                                                                   
});```                                                                                                                                                                                                                            
   


### Steps to Reproduce

1. Set up a Nuxt 4 project with @sentry/nuxt module                                                                                                                                                                               
2. Configure authToken: process.env.SENTRY_AUTH_TOKEN in nuxt.config.ts under sentry options                                                                                                                                      
3. Build inside a Docker container with SENTRY_AUTH_TOKEN passed as a build argument:                                                                                                                                             
ARG SENTRY_AUTH_TOKEN                                                                                                                                                                                                             
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN                                                                                                                                                                                          
RUN pnpm build                                                                                                                                                                                                                    
4. Verify the env var is available: echo $SENTRY_AUTH_TOKEN shows the correct value inside the container                                                                                                                          
5. Run pnpm build  
6. After the container run, if i make echo $SENTRY_AUTH_TOKEN, the token is correctly display.

### Expected Result

The Sentry Rollup plugin should read the authToken from nuxt.config.ts (which references process.env.SENTRY_AUTH_TOKEN) and upload source maps to Sentry.

### Actual Result

Build outputs this warning and source maps are not uploaded:                                                                                                                                                                      
                                                                                                                                                                                                                                  
[sentry-rollup-plugin] Warning: No auth token provided. Will not upload source maps.                                                                                                                                              
Please set the `authToken` option. You can find information on how to generate a                                                                                                                                                  
Sentry auth token here: https://docs.sentry.io/api/auth/                                                                                                                                                                          
                                                                                                                                                                                                                                  
The environment variable SENTRY_AUTH_TOKEN is confirmed to be set and accessible during the build process, but the plugin does not pick it up from the config. 

### Additional Context

- Deployment platform: Dokploy (Docker-based)                                                                                                                                                                                     
- Build system: Dockerfile                                                                                                                                                                                                 
- The same config works when running pnpm build locally with the env var exported                                                                                                                                                 
- Tried both SENTRY_AUTH_TOKEN and NUXT_SENTRY_AUTH_TOKEN variable names                                                                                                                                                          
- Also tried omitting authToken from config entirely (relying on auto-detection of SENTRY_AUTH_TOKEN) - same result                                                                                                               

### Priority

<sub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.</sub>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions