Sentry-react-native: Using React-native-sentry with Schemes

Created on 5 Sep 2018  路  10Comments  路  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [X] MacOS
  • [ ] Linux

_Platform:_

  • [X] iOS
  • [ ] Android

I have following issue:

Hello, I'm trying to get this react-native-sentry to work with https://github.com/thekevinbrown/react-native-schemes-manager to be able to use multiples schemes (Dev / Staging / Prod, with debug and release mode for each). But I can get react-native-sentry to upload the js file during the build with XCode.

The Bundle react native step looks like this:

export NODE_BINARY=node
export SENTRY_PROPERTIES=sentry.properties
export DEVELOPMENT_BUILD_CONFIGURATIONS="+(ProductionDebug|StagingDebug|DevelopmentDebug|DemoDebug|Debug)"
$NODE_BINARY ../node_modules/@sentry/cli/bin/sentry-cli react-native xcode --force-foreground ../node_modules/react-native-schemes-manager/lib/react-native-xcode.sh

I've used --force-foreground to see what's happening a bit more, and I get this

Warning: build produced no sourcemaps.

I have 2 theories, either sentry cannot understand the custom build script, or because the build is not in Debug folder , but rather inside something like this :

bundle: Writing sourcemap output to: /Users/thibault/Library/Developer/Xcode/DerivedData/brigad-blvtuinqhestvhbeghpelwzyudhd/Build/Products/StagingDebug-iphoneos/Brigad Staging.app/main.jsbundle.map

Do you have an idea ?
Thank you :)

馃react-native-sentry

Most helpful comment

When configuring schemes manager, these settings allowed it to work with no error:

    "fix-script": {
        "env": {
          "SENTRY_PROPERTIES": "./sentry.properties"
        },
        "nodeCommand": "../node_modules/@sentry/cli/bin/sentry-cli react-native xcode --allow-fetch"
      }

The --allow-fetch at the end of the node command is the important bit.

All 10 comments

I'm also hitting this issue.

I've looked into how I might get some more information about why this is happening and the error itself is coming from here https://github.com/getsentry/sentry-cli/blob/master/src/commands/react_native_xcode.rs#L211-L214

I looked into what was inside the report variable by looking at the tempory file it produces (look for the one with the UUID v4 file name inside the $TMPDIR folder) and it seems to include the correct paths:

{
    "bundle_path": "/Users/matt/Library/Developer/Xcode/DerivedData/HIDDEN/Build/Products/Dev.Debug-iphonesimulator/HIDDEN Dev.app/main.jsbundle",
    "sourcemap_path": "/Users/matt/Library/Developer/Xcode/DerivedData/HIDDEN/Build/Products/Dev.Debug-iphonesimulator/HIDDEN Dev.app/main.jsbundle.map"
}

This should mean that the report.bundle_path.is_none() || report.sourcemap_path.is_none() condition should return false and the warning should not be printed.

As this is Rust, I'm not certain how I would debug this and see more about what is going on in this command. Do you have any tips?

Just to note that I am doing export FORCE_BUNDLING=true before running the script to ensure bundling happens on debug builds (to make it easier to test).

My full build script is:

export FORCE_BUNDLING=true
export SENTRY_PROPERTIES=sentry.properties
export DEVELOPMENT_BUILD_CONFIGURATIONS="+(Dev.Debug|Alpha.Debug|Prod.Debug|Debug)"
export NODE_BINARY=node
$NODE_BINARY ../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native-schemes-manager/lib/react-native-xcode.sh

I found the issue with this.

The report file is being created successfully, however, there is a timing issue where it is being deleted before it can be read by the Sentry cli script. This is especially an issue when using react-native-schemes-manager because it runs a command after bundling (code here) which take around 1 second to complete, which is more than enough time for the temporary file to be cleaned up.

It is possible, however, for the timing issue to be a problem even without the change to the react-native-xcode.sh script if just enough time happens between the end of the bundle and this code running for the report file to have been cleaned up.

Workaround

For now, this can be worked around by modifying the react-native-schemes-manager script to not perform the additional task after bundling.

Correct fix

however, as I said this timing issue can be a problem for all users. The correct fix is to ensure that the report file is not deleted until after the entire wrapper script has been run.

Thank you for investigating! Maybe someone from sentry could help with this 馃槃 ?

@Titozzz but do you get a new release on Sentry? Because I don't even get a release to appear on my project.

No i don't

Hi, we also still have this issue. Can somebody from sentry help?

Same here. @matt-oakes have you seen any negative side-effects after remove that line in react-native-schemes-manager script?

Feel free to provide a PR for this, it's unlikely we will add support for this since this is one of the unlimited plugins that ppl use.


I am closing all old issues, please if this is still a problem feel free to revive it.
Also, consider moving to our new SDK @sentry/react-native if it still happens there please open a new issue.

When configuring schemes manager, these settings allowed it to work with no error:

    "fix-script": {
        "env": {
          "SENTRY_PROPERTIES": "./sentry.properties"
        },
        "nodeCommand": "../node_modules/@sentry/cli/bin/sentry-cli react-native xcode --allow-fetch"
      }

The --allow-fetch at the end of the node command is the important bit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sercanov picture sercanov  路  3Comments

ThomasLarge picture ThomasLarge  路  3Comments

bneigher picture bneigher  路  3Comments

kriptonhaz picture kriptonhaz  路  3Comments

juhaelee picture juhaelee  路  3Comments