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

Sentry wizard install into bare react-native project breaks use of react-native-version because of code added to project.pbxproj

Open eedeebee opened this issue 1 year ago • 2 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: 0.0.0

react-native version: 0.0.0

Are you using Expo?

  • [ ] Yes
  • [X ] No

Are you using sentry.io or on-premise?

  • [ X] sentry.io (SaaS)
  • [ ] on-premise

I have the following issue:

The sentry install wizard updated my project.pbxproj file and made it unparseable by react-native-version

Previous bits

shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";

New (and unparse-able bits) result:

shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\"\"\n";

Error from react-nativer-version

[RNV] SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found.

eedeebee avatar Jun 12 '24 20:06 eedeebee

Thinking this might be a workaround ?

shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT '/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE'\"\n";

eedeebee avatar Jun 12 '24 20:06 eedeebee

Hi @eedeebee, thank you for the message, the core of the issue is in the react-native-version parser which can't handle test = "\"" escaped quotation.

The workaround is as you mentioned to use '.

set -e

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"

/bin/sh -c "$WITH_ENVIRONMENT '/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE'"

krystofwoldrich avatar Jun 13 '24 10:06 krystofwoldrich