Skip to content

Client-side sourceMappingURL is being erased despite of settings #12219

Closed
@aacheblukov

Description

@aacheblukov

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/nextjs

SDK Version

8.4.0

Framework Version

Next 14.1.1

Link to Sentry event

https://sentry.testgrigorev-aks.arkadiumhosted.com/organizations/arkadium-test-sentry/issues/302/?query=is%3Aunresolved&referrer=issue-stream&stream_index=0

SDK Setup

sentry.client.config.ts

import * as Sentry from '@sentry/nextjs';

const isProd = process.env.BUILD_ENV === 'production';
Sentry.init({
    dsn: process.env.SENTRY_DSN,
    environment: process.env.BUILD_ENV,
    tracesSampleRate: isProd ? 0.1 : 1,
    debug: false,
    replaysOnErrorSampleRate: isProd ? 0.1 : 1.0,
    replaysSessionSampleRate: isProd ? 0.1 : 1.0,

    integrations: [
        Sentry.replayIntegration({
            maskAllText: false,
            blockAllMedia: false,
        }),
        Sentry.browserTracingIntegration(),
        
    ],
});

instrumentation.ts

import * as Sentry from '@sentry/nextjs';
export async function register() {
    const isProd = process.env.BUILD_ENV === 'production';
    Sentry.init({
        dsn: process.env.SENTRY_DSN,
        environment: process.env.BUILD_ENV,
        release: process.env.SENTRY_RELEASE,
        tracesSampleRate: isProd ? 0.1 : 1,
        debug: false,
    });
}

nextjs.config.js

const { withSentryConfig } = require('@sentry/nextjs');

/** @type {import('next').NextConfig} */
const nextConfig = {
    env: {
        SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,
        SENTRY_RELEASE: process.env.SENTRY_RELEASE,
        SENTRY_DSN: process.env.SENTRY_DSN,
        BUILD_ENV: process.env.BUILD_ENV,
    },
    output: 'standalone',
    reactStrictMode: false,
    productionBrowserSourceMaps: true,
    experimental: {
        instrumentationHook: true,
    },
    images: {
        remotePatterns: [
            {
                protocol: 'https',
                hostname: 'cdn.com',
                port: '',
                pathname: '/**',
            },
        ],
    },
    async rewrites() {
        return [
            {
                source: '/',
                destination: '/home',
            },
        ];
    },
};
const sentryWebpackPluginOptions = {
    // Additional config options for the Sentry webpack plugin. Keep in mind that
    // the following options are set automatically, and overriding them is not
    // recommended:
    //   release, url, configFile, stripPrefix, urlPrefix, include, ignore
    release: process.env.SENTRY_RELEASE,
    environment: process.env.BUILD_ENV,
    org: process.env.SENTRY_ORG,
    project: process.env.SENTRY_PROJECT,
    url: process.env.SENTRY_URL,
    authToken: process.env.SENTRY_AUTH_TOKEN,

    widenClientFileUpload: true,

    transpileClientSDK: true,
    tunnelRoute: '/monitoring',
    disableLogger: true,
    debug: true,
    telemetry: false,


    automaticVercelMonitors: true,

};

// Make sure adding Sentry options is the last code to run before exporting
module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions);

Steps to Reproduce

  1. yarn build
  2. check /.next/server/app/[...slug]/page.js
  3. There is //# sourceMappingURL=page.js.map string
  4. check /.next/static/chunks/app/[...slug]/page-${hash}.js
  5. There is no //# sourceMappingURL=page-${hash}.js.map string

Expected Result

//# sourceMappingURL=page-${hash}.js.map should be in the static files.

Actual Result

server:
image

client:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions