Skip to content

expo web not sending debug ids - metro #3638

@0mitch

Description

@0mitch

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android
  • Web

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.19.1

react-native version: 0.73.4

Are you using Expo?

  • Yes - Expo 50
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

Configuration:

Example Metro Config

// Learn more: https://docs.expo.dev/guides/monorepos/
const exclusionList = require('metro-config/src/defaults/exclusionList');
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
const { withNativeWind } = require('nativewind/metro');

const path = require('path');

const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '../..');

// Create the default Metro config
// https://docs.expo.dev/guides/using-sentry/#update-metro-configuration
const config = getSentryExpoConfig(projectRoot, { isCSSEnabled: true });

if (config.resolver) {
  // 1. Watch all files within the monorepo
  config.watchFolders = [workspaceRoot];
  // 2. Let Metro know where to resolve packages and in what order
  config.resolver.nodeModulesPaths = [
    path.resolve(projectRoot, 'node_modules'),
    // Needed to resolve deps of expo router
    path.resolve(workspaceRoot, 'node_modules/expo-router/node_modules'),
    path.resolve(workspaceRoot, 'node_modules/expo/node_modules'),
    path.resolve(workspaceRoot, 'node_modules'),
  ];
  // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
  config.resolver.disableHierarchicalLookup = true;
  // 5. Adds cjs and mjs resolutions for packages that use them as an extension
  config.resolver.sourceExts = [...config.resolver.sourceExts, 'cjs', 'mjs'];
}

module.exports = withNativeWind(config, { input: './assets/global.css' });

I have the following issue:

I've followed the instructions as per the Use Sentry Expo Documentation however our sourcemaps are still not working for our web version (bundled via metro).

Actual result:

As per the links above you can see sourcemaps are working fine for mobile however on web we get the following issue where no debug ids are sent which smells like an issue with the metro bundling on web and maybe the debug ids not being added. This results in the below error from the Sentry UI:

Screenshot 2024-02-28 at 13 13 28

Expected result:

Debug Ids are sent across from our bundled web app that is built via metro and the uploaded sourcemaps as part of the build process (pnpm sentry-expo-upload-sourcemaps ./dist) are correctly associated.

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions