getsentry / sentry-wizard

Sentry Project Setup Wizard
MIT License
186 stars 47 forks source link

TypeError: Cannot read properties of undefined (reading 'type') #534

Open ElSeniorMikael opened 7 months ago

ElSeniorMikael commented 7 months ago

Environment

React-native: 0.72.3 Sentry: 5.18.0 node: 18.19.0

Steps to Reproduce

1- new react native project 2- npx @sentry/wizard@latest -s -i reactNative

Expected Result

it should not failed

Actual Result

301616078-b62fa1c4-8126-4cd6-b18e-0ac02a9d8df9

301615582-65ba185b-3557-4ffc-ba2b-b567df9e6a89

it fail after adding the sentry init inside of App.tsx and doesnt add my sentry.property inside IOS and ANDROID folder

krystofwoldrich commented 7 months ago

Hi @ElSeniorMikael, thank you for opening the separate issue. Could you share how does you metro.config.js looks like?

ElSeniorMikael commented 7 months ago

@krystofwoldrich there's my metro.config.js


const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

const defaultConfig = getDefaultConfig(__dirname);
const {assetExts, sourceExts} = defaultConfig.resolver;
/**
 * Metro configuration
 * https://facebook.github.io/metro/docs/configuration
 *
 * @type {import('metro-config').MetroConfig}
 */

const jsoMetroPlugin = require('obfuscator-io-metro-plugin')(
  {
    // for these option look javascript-obfuscator library options from  above url
    compact: false,
    sourceMap: false,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 1,
    numbersToExpressions: true,
    simplify: true,
    stringArrayShuffle: true,
    splitStrings: true,
    stringArrayThreshold: 1,
  },
  {
    runInDev: false /* optional */,
    logObfuscatedFiles: true /* optional generated files will be located at ./.jso */,
    // source Map generated after obfuscation is not useful right now
    sourceMapLocation:
      './index.android.bundle.map' /* optional  only works if sourceMap: true in obfuscation option */,
  },
);

const config = {
  transformer: {
    babelTransformerPath: require.resolve('react-native-svg-transformer'),
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
  resolver: {
    assetExts: assetExts.filter(ext => ext !== 'svg'),
    sourceExts: [...sourceExts, 'svg'],
  },
  ...jsoMetroPlugin,
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
krystofwoldrich commented 6 months ago

Thank you @ElSeniorMikael, we'll test this config with the wizard, which should produce the same error as you are experiencing. We will keep you posted.