sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Xcode sentry-cli debug file upload Error: Project not found.

Open overhearapp opened this issue 1 year ago • 7 comments

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

Platform:

  • [x] iOS
  • [ ] Android

SDK:

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

SDK version: "~5.22.0"

react-native version: "0.74.2"

Are you using Expo?

  • [x] Yes
  • [ ] 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({
  enabled: __DEV__,
  dsn: 'MY DSN',
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
  // We recommend adjusting this value in production.
  tracesSampleRate: 1.0,
  _experiments: {
    // profilesSampleRate is relative to tracesSampleRate.
    // Here, we'll capture profiles for 100% of transactions.
    profilesSampleRate: 1.0,
  },
});

DSN redacted or

(react-native-sentry)

Sentry.config(
  'https://[email protected]/...'
  // other options
 ).install();

I have the following issue:

Using eas build for ios I get Screenshot 2024-06-19 at 08 05 30

Steps to reproduce: Note i'm using the Ignite boilerplate v9.7.1 and Expo 51 installed with npx expo install @sentry/react-native

I've followed Use Sentry instructions from Expo and changed the following files:

App.tsx

import * as Sentry from '@sentry/react-native';
import React, { useEffect } from "react";
import App from "./app/app";
import * as SplashScreen from "expo-splash-screen";
import { AppState } from 'react-native';


Sentry.init({
  enabled: __DEV__,
  dsn: 'https://b66ce6f2ff860cc5fddb62ec520b2e5c@o4507448438947840.ingest.de.sentry.io/4507448441897040',
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
  // We recommend adjusting this value in production.
  tracesSampleRate: 1.0,
  _experiments: {
    // profilesSampleRate is relative to tracesSampleRate.
    // Here, we'll capture profiles for 100% of transactions.
    profilesSampleRate: 1.0,
  },
});

function IgniteApp() {
  useEffect(() => {
    SplashScreen.preventAutoHideAsync();


    const subscription = AppState.addEventListener('change', handleAppStateChange);

    return () => {
      subscription.remove();
    };
  }, []);

  const handleAppStateChange = (nextAppState: string) => {
    if (nextAppState === 'background' || nextAppState === 'inactive') {
    }
  };

  return <App hideSplashScreen={SplashScreen.hideAsync} />
}

export default Sentry.wrap(IgniteApp);

i've added this to app.json

 "plugins": [
    "expo-localization",
    [
      "expo-build-properties",
      {
        "ios": {
          "newArchEnabled": false
        },
        "android": {
          "newArchEnabled": false
        }
      }
    ],
    "expo-font",
    [
    "@sentry/react-native/expo",
      {
        "note": "SENTRY_AUTH_TOKEN",
        "project": "SENTRY_PROJECT",
        "organization": "SENTRY_ORGANISATION"
      }
    ]
  ],

metro.config.js

// Learn more https://docs.expo.io/guides/customizing-metro
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getSentryExpoConfig(__dirname);


config.transformer.getTransformOptions = async () => ({
  transform: {
    // Inline requires are very useful for deferring loading of large dependencies/components.
    // For example, we use it in app.tsx to conditionally load Reactotron.
    // However, this comes with some gotchas.
    // Read more here: https://reactnative.dev/docs/optimizing-javascript-loading
    // And here: https://github.com/expo/expo/issues/27279#issuecomment-1971610698
    inlineRequires: true,
  },
});

// This helps support certain popular third-party libraries
// such as Firebase that use the extension cjs.
config.resolver.sourceExts.push("cjs")

module.exports = config;

and i'm using eas secrets to store my credentials in eas.json: "production": { "env": {

    "SENTRY_AUTH_TOKEN": "@SENTRY_AUTH_TOKEN",
    "SENTRY_PROJECT": "@SENTRY_PROJECT",
    "SENTRY_ORGANISATION": "@SENTRY_ORGANISATION"
  },
  "android": {
    "image": "latest"
  },
  "ios": {
    "image": "latest"
  },
  "channel": "production"
}

},

the sentry docs here https://docs.sentry.io/platforms/react-native/manual-setup/expo/ have some other additons I've tried too:

import { ExpoConfig, ConfigContext } from "@expo/config"
import { withSentry } from "@sentry/react-native/expo";

/**
 * Use ts-node here so we can use TypeScript for our Config Plugins
 * and not have to compile them to JavaScript
 */
require("ts-node/register")

/**
 * @param config ExpoConfig coming from the static config app.json if it exists
 * 
 * You can read more about Expo's Configuration Resolution Rules here:
 * https://docs.expo.dev/workflow/configuration/#configuration-resolution-rules
 */
module.exports = ({ config }: ConfigContext): Partial<ExpoConfig> => {
  const existingPlugins = config.plugins ?? []

  return {
    ...config,
    android: {
      ...config.android,
      // Use the secret for google-services.json
      googleServicesFile: process.env.GOOGLE_SERVICES_JSON,
    },
    ios: {
      ...config.ios,
      infoPlist: {
        ...config.ios?.infoPlist,
        UIBackgroundModes: [
          ...(config.ios?.infoPlist?.UIBackgroundModes || []),
          'remote-notification', 'fetch'
        ],
      },
      // Use the secret for GoogleService-Info.plist
      googleServicesFile: process.env.GOOGLE_SERVICES_INFO_PLIST,
    },
    extra: {
      eas: {
        projectId: "xxx"
      }
    },
    plugins: [
      ...existingPlugins,
      require("./plugins/withSplashScreen").withSplashScreen,
      withSentry, // Added withSentry plugin
    ],
    updates: {
      url: "xxx"
    },
    runtimeVersion: {
      policy: "appVersion"
    }
  }
}

const config: ExpoConfig = {
  name: "xxx",
  slug: "xxx",
};

export default withSentry(config, {
  url: "https://sentry.io/",
  // Use SENTRY_AUTH_TOKEN env to authenticate with Sentry.
  project: "SENTRY_PROJECT",
  organization: "SENTRY_ORGANISATION",
});

I've redacted my name, slug, updates url and eas projectid etc

Actual result:

see issue above

Expected result:

a successful build.

overhearapp avatar Jun 19 '24 07:06 overhearapp