Skip to content

Autolinking broken in 0.69 #2267

Closed
getsentry/sentry-wizard
#173

Description

@oblador

Due to react-native-community/cli#1537 some things in your react-native.config.js have been deprecated and removed, thus failing autolinking schema validation (for example ios.sharedLibraries).

Steps to Reproduce

  1. Create a vanilla RN project with latest 0.69 RC with npx react-native init Example --version 0.69.0-rc.6.
  2. Add this package.
  3. Observe it not being autolinked.

Activity

  1. marandaneto commented on Jun 7, 2022

    @marandaneto
    Contributor

    Thanks @oblador we will have a look at it.
    Likely a side effect of #2226

  2. oblador commented on Jun 7, 2022

    @oblador
    ContributorAuthor

    @marandaneto no it's unrelated, it's because of the linked PR.

  3. renchap commented on Jun 21, 2022

    @renchap

    I can confirm this.

    After upgrading to the latest RN 0.69-rc6 version and running pod update, I get:

    Downloading dependencies
    Installing DoubleConversion 1.1.6
    Installing FBLazyVector 0.69.0-rc.6 (was 0.68.2)
    Installing FBReactNativeSpec 0.69.0-rc.6 (was 0.68.2)
    Installing Flipper-DoubleConversion 3.2.0.1 (was 3.2.0)
    Installing Flipper-Glog 0.5.0.5 (was 0.5.0.4)
    Installing RCTRequired 0.69.0-rc.6 (was 0.68.2)
    Installing RCTTypeSafety 0.69.0-rc.6 (was 0.68.2)
    Installing RNReanimated 2.8.0
    Installing React 0.69.0-rc.6 (was 0.68.2)
    Installing React-Codegen 0.69.0-rc.6 (was 0.68.2)
    Installing React-Core 0.69.0-rc.6 (was 0.68.2)
    Installing React-CoreModules 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTActionSheet 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTAnimation 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTBlob 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTImage 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTLinking 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTNetwork 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTSettings 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTText 0.69.0-rc.6 (was 0.68.2)
    Installing React-RCTVibration 0.69.0-rc.6 (was 0.68.2)
    Installing React-bridging (0.69.0-rc.6)
    Installing React-callinvoker 0.69.0-rc.6 (was 0.68.2)
    Installing React-cxxreact 0.69.0-rc.6 (was 0.68.2)
    Installing React-jsi 0.69.0-rc.6 (was 0.68.2)
    Installing React-jsiexecutor 0.69.0-rc.6 (was 0.68.2)
    Installing React-jsinspector 0.69.0-rc.6 (was 0.68.2)
    Installing React-logger 0.69.0-rc.6 (was 0.68.2)
    Installing React-perflogger 0.69.0-rc.6 (was 0.68.2)
    Installing React-runtimeexecutor 0.69.0-rc.6 (was 0.68.2)
    Installing ReactCommon 0.69.0-rc.6 (was 0.68.2)
    Installing Yoga 1.14.0
    Installing glog 0.3.5
    Removing Sentry
    Generating Pods project
    

    Please note the Removing Sentry line.

    And after the upgrade, there is no Sentry-related packages in my Podfile.lock.

    As the OP said, this is most probably due to the removal of react-native link command and the refactor of auto-linking made in the PR mentioned above.

  4. kelset commented on Jun 22, 2022

    @kelset

    @marandaneto just as an headsup, we are planning on releasing 0.69.0 this week

  5. marandaneto commented on Jun 22, 2022

    @marandaneto
    Contributor

    @marandaneto just as an headsup, we are planning on releasing 0.69.0 this week

    We're going to look into this, thanks for the heads up.

    Edit: maybe useful read: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
    hooks were removed so there's a problem when doing this:

    hooks: {
    postlink:
    'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android',
    postunlink:
    'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall'
    }

  6. lucas-zimerman commented on Jun 22, 2022

    @lucas-zimerman
    Collaborator

    Additionally, we need to remove the sharedLibraries from react-native.configs in order to allow the auto link to happen.
    Or add a filter to not include those fields if running 0.69 or higher ( if that's possible)

    Despite removing those fields, something is odd with Sentry CLI

    image
    Not sure which file or folder is missing.

  7. marandaneto commented on Jun 23, 2022

    @marandaneto
    Contributor

    @lucas-zimerman iirc React Native has changed the way how it finds node, it could be related to that.
    https://reactnative.dev/blog/2022/06/21/version-069#highlights-of-069

    Addition of the new .xcode.env configuration file for more deterministically sourcing the node executable

  8. marandaneto commented on Jun 23, 2022

    @marandaneto
    Contributor

    sentry-wizard patches the xcode project file in order to be able to auto-upload debug symbols.
    The default code script has changed https://github.com/facebook/react-native/blob/main/template/ios/HelloWorld.xcodeproj/project.pbxproj#L267=
    and I guess that sentry-wizard is replacing its default react-native configuration, this could also be the culprit for sentry-cli to fail.

    Edit: also react/react-native#33777 (comment)

  9. renchap commented on Jun 24, 2022

    @renchap

    Another change for 0.69: when using XCode, there is now a .xcode.env file that allows you to set the proper environment variables for the bundle build step, for example $NODE_BINARY.

    It comes with a react-native/scripts/xcode/with-environment.sh script that will set the env var, then call its argument.

    The bundle build step becomes something like:

    export SENTRY_PROPERTIES=sentry.properties
    export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
    export PROJECT_ROOT=$PWD/..
    export NODE_MODULES_ROOT=$PROJECT_ROOT/../../node_modules
    
    WITH_ENVIRONMENT="$NODE_MODULES_ROOT/react-native/scripts/xcode/with-environment.sh"
    REACT_NATIVE_XCODE="$NODE_MODULES_ROOT/react-native/scripts/react-native-xcode.sh"
    
    $WITH_ENVIRONMENT $NODE_MODULES_ROOT/expo-constants/scripts/get-app-config-ios.sh
    $WITH_ENVIRONMENT $NODE_MODULES_ROOT/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE

    Unfortunately, this breaks @sentry/cli and I am not sure why:

    Node found at: /Users/renchap/.nvm/versions/node/v16.14.0/bin/node # <== this is the first `with-environment.sh` call for expo-constants
    Node found at: /Users/renchap/.nvm/versions/node/v16.14.0/bin/node # <== this is the second `with-environment.sh` call for sentry-cli
    sentry-cli 1.74.4
    
    Command line utility for Sentry.
    
    This tool helps you manage remote resources on a Sentry server like
    sourcemaps, debug symbols or releases.  Use `--help` on the subcommands
    to learn more about them.
    
    USAGE:
        sentry-cli <SUBCOMMAND>
    
    OPTIONS:
            --api-key <API_KEY>          The given Sentry API key.
            --auth-token <AUTH_TOKEN>    Use the given Sentry auth token.
        -h, --help                       Print this help message.
            --log-level <LOG_LEVEL>      Set the log output verbosity. [possible values: trace, debug,
                                         info, warn, error]
            --url <URL>                  Fully qualified URL to the Sentry server.
                                         [defaults to https://sentry.io/]
        -V, --version                    Print version information.
    
    SUBCOMMANDS:
        bash-hook          Prints out a bash script that does error handling.
        difutil            Locate or analyze debug information files.
        help               Prints this message or the help of the given subcommand(s)
        info               Print information about the Sentry server.
        issues             Manage issues in Sentry.
        login              Authenticate with the Sentry server.
        projects           Manage projects on Sentry.
        react-native       Upload build artifacts for react-native projects.
        releases           Manage releases on Sentry.
        repos              Manage repositories on Sentry.
        send-event         Send a manual event to Sentry.
        upload-dif         Upload debugging information files.
        upload-proguard    Upload ProGuard mapping files to a project.
    

    I guess the CLI does not properly looks up its arguments, and as it is wrapped by with-environment.sh it tries to parse sentry-cli as an argument?

  10. marandaneto commented on Jun 24, 2022

    @marandaneto
    Contributor

    I'm currently working on a troubleshooting page with a workaround in order to unblock folks.
    getsentry/sentry-docs#5208 -> preview
    We'll work on a fix as soon as we know what has to be changed.

  11. 5 remaining items

  12. ken0nek commented on Jun 30, 2022

    @ken0nek

    It would be great if we can respect .xcode.env, keep WITH_ENVIRONMENT and also make sentry work. Will take a look.

  13. marandaneto commented on Jul 1, 2022

    @marandaneto
    Contributor

    It would be great if we can respect .xcode.env, keep WITH_ENVIRONMENT and also make sentry work. Will take a look.

    That's already possible, See docs getsentry/sentry-docs#5240

  14. ken0nek commented on Jul 1, 2022

    @ken0nek

    Thank you so much for the info!

  15. pinned this issue on Jul 3, 2022
  16. jmz527 commented on Jul 12, 2022

    @jmz527

    Hi there! Just checking on that status of this? Should I not wait and just go w/ the workaround?

  17. scrgh commented on Jul 19, 2022

    @scrgh

    Any update on release fix ?

  18. bruno-garcia commented on Jul 19, 2022

    @bruno-garcia
    Member

    The patch from @marandaneto has been approved by @kamilogorek : getsentry/sentry-wizard#173 (review)

    Manoel is back online tomorrow so we should see this patch merged, and a new release of sentry-wizard coming out soon. Sorry for the delay on this one folks.

  19. marandaneto commented on Jul 21, 2022

    @marandaneto
    Contributor

    I'll release a new version once https://github.com/getsentry/sentry-wizard 2.0.0 and #2332 gets released.

  20. marandaneto commented on Jul 22, 2022

    @marandaneto
    Contributor

    Going to be released as 5.0.0-alpha.0

  21. added this to the 5.0.0 milestone on Aug 17, 2022
  22. locked and limited conversation to collaborators on Aug 30, 2022
  23. unpinned this issue on Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions