expo / sentry-expo

MIT License
202 stars 83 forks source link

Error: You attempted to set the key `sdk` with the value #347

Closed pkayfire closed 1 year ago

pkayfire commented 1 year ago

Summary

Getting the following error when updating App.tsx on a Expo development build with sentry-expo.

 WARN  [sentry-expo] Disabling the Sentry Native SDK (all JS errors will still be reported).
To enable it, run 'yarn add @sentry/react-native' or 'npm install @sentry/react-native' in your project directory. To silence this warning, pass 'enableNative: false' to Sentry.init().
 ERROR  Error: You attempted to set the key `sdk` with the value `{"name":"sentry.javascript.react-native.expo","packages":[{"name":"npm:sentry-expo","version":"6.2.1"},{"name":"npm:@sentry/react-native","version":"4.15.2"}],"version":"6.2.1"}` on an object that is meant to be immutable and has been frozen., js engine: hermes

Error does not occur when enableNative is set to false.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

48

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.0.1 Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.16.0 - /usr/local/bin/node Yarn: 1.22.15 - ~/.yarn/bin/yarn npm: 8.1.2 - /usr/local/bin/npm Managers: CocoaPods: 1.8.4 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.3 System Images: android-29 | Google Play Intel x86 Atom IDEs: Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild npmPackages: expo: ^48.0.16 => 48.0.19 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-web: ~0.18.9 => 0.18.12 npmGlobalPackages: eas-cli: 3.13.3 expo-cli: 6.3.8 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

Any build with sentry-expo v6.2.1.

denisbarriere commented 1 year ago

Facing the same issue. Reverting to @sentry/react-native@4.13.0 and sentry-expo@6.1.1 solved the issue, but I now get the following warning when running npx expo start.

Some dependencies are incompatible with the installed expo version:
  @sentry/react-native@4.13.0 - expected version: 4.15.2
  sentry-expo@6.1.1 - expected version: ~6.2.0
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install @sentry/react-native@4.15.2 sentry-expo@~6.2.0
pkayfire commented 1 year ago

FWIW, production build runs fine, but it is annoying that my dev build crashes every time I edit App.tsx. Would appreciate a speedy resolution to this issue from the maintainers.

Thanks ahead of time!

MorenoMdz commented 1 year ago

Hey there, this issue is affecting us directly, our production build works fine but we are waiting to upgrade our Sentry packages and expo sentry to fix one other issues related to Sentry Java that was causing our App to crash on reload, and we do reload the App to apply OTA updates. Basically this is causing our app to be in a state we cant enforce OTA updates until this is fixed. : /

matous94 commented 1 year ago

@MorenoMdz

The problem with reload causing crash is solved in sentry-expo pre-release. https://github.com/expo/sentry-expo/releases/tag/v7.0.0

MorenoMdz commented 1 year ago

@MorenoMdz

The problem with reload causing crash is solved in sentry-expo pre-release. https://github.com/expo/sentry-expo/releases/tag/v7.0.0

Yes but then we get this error

matous94 commented 1 year ago

@MorenoMdz

Well this error is just an inconvenience while developing, version 7 works well, at least in my case anyway. Hopefully this will be fixed soon though, looking forward to it.

vKongv commented 1 year ago

Hi, is this only affecting dev build? I am facing this issue in my sentry-expo@6.2.1 and @sentry/react-native@4.15.2

MorenoMdz commented 1 year ago

@MorenoMdz

Well this error is just an inconvenience while developing, version 7 works well, at least in my case anyway. Hopefully this will be fixed soon though, looking forward to it.

I am not sure I can agree with that since the app crashing every time we save something is pretty bad.

matous94 commented 1 year ago

@MorenoMdz

Yeah I can imagine, if it's happening to you on every save, that's not my case. Maybe disabling Sentry in DEV would do the trick.

Kwabena-Agyeman commented 1 year ago

Facing the same issue in my expo dev client, pretty annoying issue

opeah commented 1 year ago

Facing the same issue with development build

ahilles107 commented 1 year ago

Facing the same issue, it crashes on every change.

mGallee commented 1 year ago

Facing the same issue with expo dev client

TideOPL commented 1 year ago

Same problem here.

rogerrc12 commented 1 year ago

Same problem here. Any update on this?

pkayfire commented 1 year ago

Fix in sentry-expo 7.0.1 is now causing an fastlane error when building for production. See https://github.com/expo/sentry-expo/issues/359.

Thanks for the help

claudiofus commented 1 year ago

I'm facing the same error after the creation of Expo secret and removing authToken from my app.json. With authToken in my app.json I have a security alert but no error and the build works fine.

Tried with 7.0.1 but doesn't work, same error.

first-dev commented 10 months ago

Here is a workaround that worked for me

if (__DEV__) {
  if (!global.sentryInit) {
    Sentry.init({
      ...
    });
    global.sentryInit = true;
  }
} else {
  Sentry.init({
    ...
  });
}
claudiofus commented 10 months ago

Didn't work in my case, I tried with app.config.js and with a simple app.json, removing authToken from app.json

nickbuc1 commented 10 months ago

Facing the same issue. expo sdk 48, sentry-expo: 6.2.0, @sentry/react-native: 4.15.2 Any update or any idea on how to fix this? Thanks!

shaolinjr commented 9 months ago

Anyone with a fix?