Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using React-native-sentry with Schemes #473

Closed
2 of 5 tasks
Titozzz opened this issue Sep 5, 2018 · 10 comments
Closed
2 of 5 tasks

Using React-native-sentry with Schemes #473

Titozzz opened this issue Sep 5, 2018 · 10 comments

Comments

@Titozzz
Copy link
Contributor

Titozzz commented Sep 5, 2018

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • 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 :)

@matt-oakes
Copy link

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?

@matt-oakes
Copy link

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

@matt-oakes
Copy link

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.

@Titozzz
Copy link
Contributor Author

Titozzz commented Nov 22, 2018

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

martnu added a commit to LeeroyGroup/react-native-schemes-manager that referenced this issue Dec 4, 2018
@joaovpmamede
Copy link

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

@Titozzz
Copy link
Contributor Author

Titozzz commented Jan 8, 2019

No i don't

@kuglemic
Copy link

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

@sregg
Copy link

sregg commented May 14, 2019

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

@HazAT
Copy link
Member

HazAT commented Sep 4, 2019

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.

@HazAT HazAT closed this as completed Sep 4, 2019
@matt-oakes
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants