expo / sentry-expo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EAS Build Failing on iOS (Local and Remote) with @sentry/react-native 4.13.0 Config

gtwilliams03 opened this issue · comments

Summary

EAS builds for the IOS platform are failing in my project since upgrading to Expo SDK 48. The build is failing local and remote. The build throws this error which is likely related to the dependency on @sentry/react-native to version 4.13.0 which includes a deprecated configuration file (see here). This article mentions that the config dependency. platforms.ios.sharedLibraries and dependency.hooks are now invalid.

My build error reflects this:

Package @sentry/react-native contains invalid configuration: "dependency.platforms.ios.sharedLibraries" is not
allowed,"dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command 
and contact the package maintainers about this.

The updated versions of @sentry/react-native (currently at 5.2.0) include an updated react-native.config.js with a new config that does not include the prohibited keys:

module.exports = {
  dependency: {
    platforms: {
      ios: {},
      android: {
        packageInstance: 'new RNSentryPackage()',
        packageImportPath: 'import io.sentry.react.RNSentryPackage;'
      }
    }
  }
};

Is there a way to update this package to include the current version of the @sentry/react-native package? I think this would resolve my build error.

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.2.1
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn
npm: 9.6.2 - ~/.nvm/versions/node/v18.15.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9477386
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
npmPackages:
babel-preset-expo: ^9.3.0 => 9.3.1
expo: ^48.0.9 => 48.0.9
react: 18.2.0 => 18.2.0
react-native: 0.71.4 => 0.71.4
react-native-web: ~0.18.11 => 0.18.12
npmGlobalPackages:
eas-cli: 3.8.1
expo-cli: 6.3.2
Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

I will try and develop a reproducible repo but every project I am working on has this build error.

If you do an install of sentry-expo, it installs 6.1.1. If you do an install of @sentry/react-native (per the "Using Sentry" instructions), it will install 5.2.0. But this causes the expo doctor step of the build to fail:

 - @sentry/react-native - expected version: 4.13.0 - actual version installed: 5.2.0
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo doctor --fix-dependencies,
or install individual packages by running expo install [package-name ...]

So you are pushed back to @sentry/react-native@4.13.0 and the bad config with the deprecated properties.

I am going to close this for now. I uninstalled sentry completely and still get the build error.

I rolled the code base back to Expo SDK 47 and it built fine.

Once I got the codebase rolled back to Expo SDK 47, I performed the upgrade steps to move to SDK 48. The build on iOS started failing again. I went through the Xcode logs for this project and one that is working on Expo 48, and I noticed one line different between the two after the following code:

+ [[ '' == true ]]
+ BUNDLE_FILE=/Users/expo/Library/Developer/Xcode/DerivedData/SeveredLinks-chtbwvsetxaswpbmirjommfynwra/Build/Intermediates.noindex/ArchiveIntermediates/SeveredLinks/BuildProductsPath/Release-iphoneos/SeveredLinks.app/main.jsbundle
+ [[ false != true ]]
+ [[ ! -f /Users/expo/Library/Developer/Xcode/DerivedData/SeveredLinks-chtbwvsetxaswpbmirjommfynwra/Build/Intermediates.noindex/ArchiveIntermediates/SeveredLinks/BuildProductsPath/Release-iphoneos/SeveredLinks.app/main.jsbundle ]]
Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Bundled 2 files for upload
> Uploaded release files to Sentry
> File upload complete (processing pending on server)
> Organization: severed-links
> Project: severedlinks-react-native-app
> Release: com.severedlinks.severed-links-app@1.0.308+1.0.308
> Dist: 1.0.308

Source Map Upload Report
  Scripts
    ~/main.jsbundle
  Source Maps
    ~/main.jsbundle.map

A rather non-descript error appears:

Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure

I get the source maps uploaded to sentry.io and I see a new release created. But the eas build fails so I cannot submit the build.

Any idea where I should look to see why this strange error is happening?

The Xcode logs for the exact same codebase on Expo SDK 47 upload the sourcemaps correctly and do not emit the error. But if I do nothing else but upgrade the codebase to SDK 48 it throws the error.

I'll leave the solution here in case it helps anyone else find a needle in a haystack. I had a few warnings about duplicate property values being assigned. I kind of ignored them since they were just warnings. But I was still getting the Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure error without any actual errors in the fastlane or Xcode logs. Turns out, if you happen to assign an error: property twice (i.e., the property "error" was set multiple times in the object definition ), the warning actually causes an error to be emitted (which is why there was no error message). Resolving this warning (even though there were a number of other duplicate assignment warnings), fixed the build.

/Users/expo/Library/Developer/Xcode/DerivedData/SeveredLinks-chtbwvsetxaswpbmirjommfynwra/Build/Intermediates.noindex/ArchiveIntermediates/SeveredLinks/BuildProductsPath/Release-iphoneos/main.jsbundle:74489:7: warning: the property "error" was set multiple times in the object definition.
      error: null,
      ^~~~~~~~~~~
/Users/expo/Library/Developer/Xcode/DerivedData/SeveredLinks-chtbwvsetxaswpbmirjommfynwra/Build/Intermediates.noindex/ArchiveIntermediates/SeveredLinks/BuildProductsPath/Release-iphoneos/main.jsbundle:74478:7: note: The first definition was here.
      error: {},
      ^~~~~~~~~

Wait, how can this be closed? How are we supposed to resolve this, we who run SDK 48?