Fix concurrent runs with Sentry Babel transformer
feidaZhang opened this issue · 14 comments
OS:
- Windows
- MacOS
- Linux
Platform:
- iOS
- Android
SDK:
-
@sentry/react-native
(>= 1.0.0) -
react-native-sentry
(<= 0.43.2)
SDK version: 5.30.0
react-native
version: 0.72.12
Are you using Expo?
- Yes
- No
I have the following issue:
After integrating withSentryConfig
in the metro.config.js
, annotateReactComponents
is true, we found that when building iOS application through Xcode in debug mode, the .sentry/. defaultBabelTransformerPath
file was first created and then deleted before the build was completed. However, when loading the JS Bundle, sentry tried to read the file again and threw an error.
Actual result:
Expected result:
no error
if i comment this line. There is no error but the file can not be deleted automatically.
function withSentryBabelTransformer(config) {
const defaultBabelTransformerPath = config.transformer && config.transformer.babelTransformerPath;
utils_1.logger.debug('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);
if (!defaultBabelTransformerPath) {
// This has to be console.warn because the options is enabled but won't be used
// eslint-disable-next-line no-console
console.warn('`transformer.babelTransformerPath` is undefined.');
// eslint-disable-next-line no-console
console.warn('Sentry Babel transformer cannot be used. Not adding it...');
return config;
}
if (defaultBabelTransformerPath) {
(0, sentryBabelTransformerUtils_1.saveDefaultBabelTransformerPath)(defaultBabelTransformerPath);
process.on('exit', () => {
// comment this line
// (0, sentryBabelTransformerUtils_1.cleanDefaultBabelTransformerPath)();
});
}
return Object.assign(Object.assign({}, config), { transformer: Object.assign(Object.assign({}, config.transformer), { babelTransformerPath: require.resolve('./sentryBabelTransformer') }) });
}
It's my device info.
Model Name: MacBook Pro
Model Identifier: MacBookPro17,1
Model Number: Z11C000BPCH/A
Chip: Apple M1
Thanks @feidaZhang for the report, we'll investigate this and follow up here
Hello @feidaZhang 👋
thank you for your report and the provided information. I debugged the issue with the reported configuration (SDK version: 5.30.0
, react-native version: 0.72.12
) but wasn't able to reproduce.
Could you set the log level to debug:
export SENTRY_LOG_LEVEL=debug
and provide us with some extra logs from metro E.g.
Sentry Logger [debug]: Default Babel transformer path from `config.transformer`: [TRANSFORMER_PATH]
Sentry Logger [debug]: Saved default Babel transformer path
...
Sentry Logger [debug]: Loading default Babel transformer from [TRANSFORMER_PATH]
Sentry Logger [debug]: Cleaned default Babel transformer path
✨ Done in 7.23s.
Do you see the Cleaned default Babel transformer path
before metro termination?
We also noticed that the provided screenshot is from the macOS app. Could you confirm if you are building the iOS or macOS app with XCode? Have you made any other customisations in your Xcode setup?