Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source maps not matching due to file renaming in @sentry/nextjs #13730

Closed
3 tasks done
annielinnik opened this issue Sep 19, 2024 · 9 comments
Closed
3 tasks done

Source maps not matching due to file renaming in @sentry/nextjs #13730

annielinnik opened this issue Sep 19, 2024 · 9 comments
Labels
Feature: Source Maps Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@annielinnik
Copy link

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

Framework Version

Next 14.2.6

Link to Sentry event

No response

Reproduction Example/SDK Setup

// sentry.client.config.ts
import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: '...',
  debug: true,
  enabled: true,
  environment: process.env.NEXT_PUBLIC_APP_ENV,
});

// sentry.server.config.ts , sentry.edge.config.ts
import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: '...',
  debug: true,
});

Steps to Reproduce

  1. Throw an error from sentry-example-page generated with npx @sentry/wizard@latest -i sourcemaps
  2. Source maps for this event not working:
  1. This is how the artifacts look like:

The way I see it: Sentry renames files, replacing their names with Debug ID and moving them to the root folder; then Sentry tries to find a file in _next/server/* and fails because there's no such file.

My next.config.js:

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  output: "standalone",
  i18n: {
    locales: ["en"],
    defaultLocale: "en",
  },
  // fix 'fn' not found
  webpack(config, { webpack }) {
    config.resolve.fallback = {
      fs: false,
      dns: false,
      child_process: false,
    };
    config.plugins.push(
      new webpack.DefinePlugin({
        __SENTRY_DEBUG__: false,
        __SENTRY_TRACING__: false,
      })
    );
    return config;
  },

  async redirects() {
    return [];
  },

  async headers() {
    return [
      {
        // Apply these headers to all routes in your application.
        source: "/:any*",
        headers: [
          {
            key: "X-Frame-Options",
            value: "SAMEORIGIN",
          },
        ],
      },
    ];
  },

  experimental: {
    forceSwcTransforms: true,
    instrumentationHook: true,
  },
};

const nextConfigWithSentry = withSentryConfig(nextConfig, {
  authToken: process.env.SENTRY_AUTH_TOKEN,
  org: "sentry",
  project: "...",
  widenClientFileUpload: true,
  transpileClientSDK: true,
  disableLogger: false,
});

module.exports = nextConfigWithSentry;

Expected Result

Files uploaded to Sentry with their original names and paths. Source maps work.

Actual Result

Every file is renamed with format [debug_id].js and [debug_id].js.map and uploaded at root folder.

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Sep 19, 2024
@lforst
Copy link
Member

lforst commented Sep 19, 2024

Hi, the modal tells you "capture a new event to verify the changes". Can you try and do so? Make sure you set "latest" in the dropdown in the error in the top right corner instead of "recommended". Thanks!

@K-Jean
Copy link

K-Jean commented Sep 19, 2024

Hi ! same problem here with nextjs 15rc. Files are uploaded with the [debug_id].js and not with the served filename :

Image

Image

Image

@annielinnik
Copy link
Author

@lforst Same with the 'latest' event. This modal suggests to capture new events for months now, every new event has the same issue.

@lforst
Copy link
Member

lforst commented Sep 20, 2024

@K-Jean @annielinnik would you mind providing a link to an event where this happens? Thanks!

@lforst
Copy link
Member

lforst commented Sep 20, 2024

Oh @annielinnik you're on self hosted. Please check the logs of your symbolicator service.

@K-Jean
Copy link

K-Jean commented Sep 20, 2024

I'm also in self-hosted environnement. We have a lot of errors in the symbolicator service :

symbolicator-1  | 2024-09-19T21:20:38.952866391Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:20:38.952887451Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:20:38.952911202Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:20:38.952931272Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:20:38.952956083Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:20:38.952977453Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:27:08.26203245Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:27:08.262105062Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:27:38.263662134Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-19T21:27:38.263724635Z ERROR symbolicator_service::download: Failed to fetch file list error=download timed out after 30s
symbolicator-1  | 2024-09-20T06:17:59.271961773Z ERROR symbolicator_service::caching::memory: Failed to create cache directory: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
symbolicator-1  | 2024-09-20T06:17:59.272025495Z ERROR symbolicator_service::caching::memory: Failed to create cache directory: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
symbolicator-1  | 2024-09-20T06:17:59.272045005Z ERROR symbolicator_service::caching::memory: Failed to create cache directory: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
symbolicator-1  | 2024-09-20T06:17:59.272075666Z ERROR symbolicator_service::caching::cache_error: error=Permission denied (os error 13)
symbolicator-1  | 2024-09-20T07:11:03.761606347Z ERROR symbolicator_service::caching::memory: Failed to create cache directory: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
symbolicator-1  | 2024-09-20T07:11:03.761651387Z ERROR symbolicator_service::caching::memory: Failed to create cache directory: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
symbolicator-1  | 2024-09-20T07:11:03.761667268Z ERROR symbolicator_service::caching::memory: Failed to create cache directory: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
symbolicator-1  | 2024-09-20T07:11:03.761686718Z ERROR symbolicator_service::caching::cache_error: error=Permission denied (os error 13)

@lforst
Copy link
Member

lforst commented Sep 20, 2024

Well that looks like the problem. Seems like you need to give the service network access to your Sentry service and also file write permissions.

@K-Jean
Copy link

K-Jean commented Sep 20, 2024

Hello @lforst you point the right direction for me, I fixed the folder rights see this ticket : getsentry/self-hosted#3114

@AbhiPrasad
Copy link
Member

Closing this for clean-up. Please re-open if it still applies. Thanks!

@AbhiPrasad AbhiPrasad closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Source Maps Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
Archived in project
Development

No branches or pull requests

4 participants