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

Dependancy isomorphic-webcrypto not compatible with latest React Native #9

Closed
theblockstalk opened this issue Jul 23, 2024 · 3 comments

Comments

@theblockstalk
Copy link

theblockstalk commented Jul 23, 2024

The dependency isomorphic-webcrypto is not compatible with the latest React Native v0.73+ and still depends on the old @unimodules/core and @unimodules/react-native-adapter.

See article here explaining the upgrade: https://dev.to/wbroek/migrate-from-react-native-unimodules-to-expo-modules-25c6

This change has broken when I upgraded from expo v49 (React Native 0.72) to v50 (RN 0.73)

This is causing build errors in upstream repositories that are using the latest RN/expo

Steps to reproduce

npx create-expo-app@latest
# create new app called "my-app"
cd my-app
npm i digitalcredentials/jsonld-signatures
npx expo-doctor@latest

Problem

✖ Check that native modules do not use incompatible support packages
✖ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

Expected to not find any copies of @unimodules/core
Found invalid:
  @unimodules/[email protected]
  (for more info, run: npm why @unimodules/core)
Expected to not find any copies of @unimodules/react-native-adapter
Found invalid:
  @unimodules/[email protected]
  (for more info, run: npm why @unimodules/react-native-adapter)
Advice: Remove any 'unimodules' packages from your project. Learn more: Learn more: https://expo.fyi/r/sdk-44-remove-unimodules

Expected package expo-modules-autolinking@~1.11.0
Found invalid:
  [email protected]
  (for more info, run: npm why expo-modules-autolinking)
Advice: Upgrade dependencies that are using the invalid package versions0.

This project has multiple package manager lock files (yarn.lock, package-lock.json). This may cause EAS build to restore dependencies with a different package manager from what you use in other environments.

One or more checks failed, indicating possible issues with the project.

This is then causing build errors in EAS:
image

Run Gradel step

Running 'gradlew :app:assembleDebug' in /home/expo/workingdir/build/android
Welcome to Gradle 8.3!
Here are the highlights of this release:
- Faster Java compilation
 - Reduced memory usage
 - Support for running on Java 20
For more details see https://docs.gradle.org/8.3/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.3/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build
> Configure project :
Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
> Task :expo-dev-launcher-gradle-plugin:pluginDescriptors
> Task :gradle-plugin:pluginDescriptors
> Task :gradle-plugin:processResources
> Task :expo-dev-launcher-gradle-plugin:processResources
> Task :expo-dev-launcher-gradle-plugin:compileKotlin
> Task :expo-dev-launcher-gradle-plugin:compileJava NO-SOURCE
> Task :expo-dev-launcher-gradle-plugin:classes
> Task :expo-dev-launcher-gradle-plugin:jar
> Task :expo-dev-launcher-gradle-plugin:inspectClassesForKotlinIC
> Task :gradle-plugin:compileKotlin
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:classes
> Task :gradle-plugin:jar
> Task :gradle-plugin:inspectClassesForKotlinIC
> Configure project :app
 ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' ([email protected])
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/home/expo/workingdir/build/node_modules/@unimodules/core/android/build.gradle' line: 3
* What went wrong:
A problem occurred evaluating project ':unimodules-core'.
> Plugin with id 'maven' not found.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org/.
==============================================================================
2: Task failed with an exception.
-----------
* Where:
Script '/home/expo/workingdir/build/node_modules/expo-modules-core/android/ExpoModulesCorePlugin.gradle' line: 65
* What went wrong:
A problem occurred configuring project ':expo'.
> Could not get unknown property 'release' for SoftwareComponent container of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org/.
==============================================================================
BUILD FAILED in 2m 26s
10 actionable tasks: 10 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Environment

Local build environment

  • Node.js 22.3.0
  • Yarn 1.22.19

EAS Expo build environment

Using image "ubuntu-22.04-jdk-17-ndk-25.1.8937393" based on "ubuntu-2204-jammy-v20220810"

Installed software:

  • NDK 25.1.8937393
  • Node.js 18.18.0
  • Bun 1.0.14
  • Yarn 1.22.19
  • pnpm 8.9.2
  • npm 9.8.1
  • Java 17
  • node-gyp 10.0.1

Possible solutions

Try using @sphereon/isomorphic-webcrypto instead? Perhaps this is better.

@theblockstalk
Copy link
Author

Looks like this is what Sphereon is doing: https://github.com/Sphereon-Opensource/mobile-wallet/blob/f01fe0b6580d2affa0ffc5f0031a737e0b6ecfdb/package.json#L294

package.json

"resolutions": {
  "**/isomorphic-webcrypto": "link:./node_modules/@sphereon/isomorphic-webcrypto",
}

@theblockstalk
Copy link
Author

Confirmed working:

yarn add @sphereon/isomorphic-webcrypto

package.json

"resolutions": {
        "isomorphic-webcrypto": "link:./node_modules/@sphereon/isomorphic-webcrypto"
    },

@dmitrizagidulin
Copy link
Member

Switched to latest @sphereon/[email protected] in latest release (v10.1.0), closing issue.

@alexfigtree alexfigtree moved this to Done (Deployed) in DCC Engineering Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (Deployed)
Development

No branches or pull requests

2 participants