TypeError: options.shouldAddToIgnoreList is not a function
OS:
- [ ] Windows
- [X] MacOS
- [ ] Linux
Platform:
- [X] iOS
- [X] Android
SDK:
- [X]
@sentry/react-native(>= 1.0.0) - [ ]
react-native-sentry(<= 0.43.2)
SDK version: 5.19.0
react-native version: 0.71.13
Are you using Expo?
- [ ] Yes
- [X] No
Are you using sentry.io or on-premise?
- [X] sentry.io (SaaS)
- [ ] on-premise
If you are using sentry.io, please post a link to your issue so we can take a look:
[Link to issue]
Configuration:
(@sentry/react-native)
Sentry.init({
dsn: 'https://[email protected]/...'
// other options
});
I have the following issue:
[Description]
Steps to reproduce:
- Start to archive process in xcode
- Throwed exception when bundling metro step
Actual result:
error options.shouldAddToIgnoreList is not a function.
TypeError: options.shouldAddToIgnoreList is not a function
at getSourceMapInfo (/Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:18:24)
at processNextModule (/Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:30:18)
at workLoop (/Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:40:22)
at getSourceMapInfosImpl (/Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:60:3)
at sourceMapGenerator (/Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:64:3)
at sourceMapString (/Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/metro/src/DeltaBundler/Serializers/sourceMapString.js:16:10)
at /Users/muratoner/Desktop/Projects.SabanciDx/hrweb/node_modules/@sentry/react-native/dist/js/tools/vendor/metro/utils.js:42:21
at Object.
Expected result:
Take an archive in xcode
same error here trying to generate source maps:
error options.shouldAddToIgnoreList is not a function.
TypeError: options.shouldAddToIgnoreList is not a function
at getSourceMapInfo (/Users/[email protected]/tr_spinplus/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:7:24)
at processNextModule (/Users/[email protected]/tr_spinplus/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:19:18)
at workLoop (/Users/[email protected]/tr_spinplus/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:29:22)
at getSourceMapInfosImpl (/Users/[email protected]/tr_spinplus/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:44:3)
at sourceMapGenerator (/Users/[email protected]/tr_spinplus/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:48:3)
at sourceMapString (/Users/[email protected]/tr_spinplus/node_modules/metro/src/DeltaBundler/Serializers/sourceMapString.js:5:10)
at /Users/[email protected]/tr_spinplus/node_modules/@sentry/react-native/dist/js/tools/vendor/metro/utils.js:42:21
at Object.debugId from packager source map to Hermes source map...
Packager source map does not have debugId.
Found 1 file Analyzing 1 sources Analyzing completed in 0.021s Rewriting sources Rewriting completed in 0.139s Adding source map references Bundling completed in 0.233s Bundled 1 file for upload Bundle ID: 92c0c796-2abc-55da-b721-c3432e95c6e5 Optimizing completed in 0.003s Uploading completed in 0.428s Uploaded files to Sentry Processing completed in 0.32s File upload complete (processing pending on server) Organization: femsa-digital Project: spin-premia Release: [email protected]+1 Dist: 1 Upload type: artifact bundle
Source Map Upload Report Source Maps ~/index.android.bundle.map
Hi @muratoner and @gerdigitalfemsa, thank you for the messages,
this is usually a result of the hoisted metro version and the metro shipped with RN.
Can you share what version of Metro is ./node_modules/metro?
Does the issue resolve when you install [email protected]?
i am having a same error
when i try to build ios bundler file i get :
Recrawled this watch 75 times, most recently because: MustScanSubDirs UserDroppedTo resolve, please review the information on https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl To clear this warning, run:watchman watch-del '/Users/levancho/dev/kwickie/kwikorder-ui-gary' ; watchman watch-project '/Users/levancho/dev/kwickie/kwikorder-ui-gary'`
error options.shouldAddToIgnoreList is not a function.
TypeError: options.shouldAddToIgnoreList is not a function
at getSourceMapInfo (/Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:18:24)
at processNextModule (/Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:30:18)
at workLoop (/Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:40:22)
at getSourceMapInfosImpl (/Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:60:3)
at sourceMapGenerator (/Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js:64:3)
at sourceMapString (/Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/metro/src/DeltaBundler/Serializers/sourceMapString.js:16:10)
at /Users/levancho/dev/kwickie/kwikorder-ui-gary/node_modules/@sentry/react-native/dist/js/tools/vendor/metro/utils.js:42:21
at Object.
I tried with metro versions all the way up to 0.76 (inclusive) same error.
is there an update on this? we are blocked..
Hi @muratoner and @gerdigitalfemsa, thank you for the messages,
this is usually a result of the hoisted metro version and the metro shipped with RN.
Can you share what version of Metro is
./node_modules/metro?Does the issue resolve when you install
[email protected]?
My ./node_modules/metro version is 0.80.5
testing the build on Xcode cloud.. will report the result here ..
so, problem I think is that many users do not explicitly declare metro dependencies, since its get pulled down transitively anyways.. so with react native 0.71.14 I am getting metro version that was breaking this.. so explicitly adding 0.73.10 fixed the problem. but only that version all others versions did not work for me, including 0.86.
@krystofwoldrich i got
"version": "0.73.10",
Thank you all for your findings, we're investigating
I am also getting this error when updating sentry with the wizard. Is it possible still to add sentry without the metro.config.js changes?
Hi @sisoalbert,
you can use Sentry without modifying the metro.config.js, but you will have to ensure release and dist are correctly set for source maps mapping. Debug IDs, which are used by default, won't be available, because they are generated in the Metro Sentry serializer.
https://docs.sentry.io/platforms/react-native/sourcemaps/troubleshooting/optional-release-and-distribution/
@muratoner Have installing [email protected] resolved the issue?
Current workaround to fix the issue
-
Check what version of
metrois used by your version ofreact-nativeExample:
[email protected]usesmetro@^0.80.3(package.json) -
Install that
metroversion as a dependency in your project.Example:
npm install metro@^0.80.3
The solution is to not rely on hoisted metro dependency and resolve react-native -> @react-native-community/cli-plugin-metro or @react-native/community-cli-plugin -> metro, which is the metro package used by the React Native CLI.
const reactNativeDir = require.resolve('react-native/package.json');
const cliDir = require.resolve('@react-native/community-cli-plugin/package.json', { paths: [reactNativeDir] });
const metroDir = require.resolve('metro/package.json', { paths: [cliDir] });
console.log('info ' + `reactNativeDir: ${reactNativeDir}`);
console.log('info ' + `cliDir: ${cliDir}`);
console.log('info ' + `metroDir: ${metroDir}`);
Add a troubleshooting note to https://docs.sentry.io/platforms/react-native/manual-setup/metro/
I had a similar issue in a monorepo setup
Fixed by
- I had dependency conflicts, had metro-config, metro-react-native-babel-preset and @react-native/metro-config present in my package.json
- removed old ones (metro-config, metro-react-native-babel-preset)
- kept official one for latest RN 0.73.6 which is "@react-native/metro-config": "0.73.5"
- Ensure metro dependencies are not hoisted and available at package node_modules, not root mono repo node_modules at root package.json add to achieve that
"nohoist": [ "**/@react-native/**", ]
@NabeelZanabeet Thank you for sharing the steps.
I get this exact same error on App-center, although i am able to build locally from my IDE and with xcode. This is what my metro-file looks like:
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const {createSentryMetroSerializer} = require('@sentry/react-native/dist/js/tools/sentryMetroSerializer');
module.exports = (async () => {
// default Metro configuration
const defaultConfig = await getDefaultConfig(__dirname);
const {
resolver: {sourceExts, assetExts},
} = defaultConfig;
// custom configuration for Sentry
const sentryConfig = {
serializer: {
customSerializer: createSentryMetroSerializer(),
},
};
// existing custom configuration
const customConfig = {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
},
};
// Merge Sentry configuration with all custom configuration
const config = mergeConfig(defaultConfig, sentryConfig, customConfig);
return config;
})();
Hi @sleekLancelot, have you tried this workaround?
- https://github.com/getsentry/sentry-react-native/issues/3622#issuecomment-1971056220
Likely the local node_modules modules do not match the server, you can try to remove the local node_modules and install them again, the should help with reproducing the issue.
Hi @sleekLancelot, have you tried this workaround?
Likely the local node_modules modules do not match the server, you can try to remove the local node_modules and install them again, the should help with reproducing the issue.
Hi Krystof, not sure why this didn't work hours ago, but i tried it again and it worked!
i have "react-native": "0.71.4" installed. Which uses "metro-runtime": "0.73.8"
so i did yarn add [email protected]
And now the build was succesful!
Thanks alot for your help.
@sleekLancelot Awesome, no worries, I'm happy to hear it worked out.
I've tested that the following logic resolves the correct metro non hoisted metro package.
const reactNativeDir = require.resolve('react-native/package.json');
const cliDir = require.resolve('@react-native/community-cli-plugin/package.json', { paths: [reactNativeDir] });
const metroDir = require.resolve('metro/package.json', { paths: [cliDir] });
console.log('info ' + `reactNativeDir: ${reactNativeDir}`);
console.log('info ' + `cliDir: ${cliDir}`);
console.log('info ' + `metroDir: ${metroDir}`);