aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.43k stars 2.13k forks source link

Adding @aws-amplify/rtn-web-browser to react-native project causes build failure on Android #13658

Closed mretiinteractivebrokers closed 3 months ago

mretiinteractivebrokers commented 3 months ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify CLI

Environment information

``` # Put output below this line System: OS: macOS 14.5 CPU: (8) arm64 Apple M3 Memory: 98.84 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.7.0 - /usr/local/bin/node npm: 8.15.0 - /usr/local/bin/npm Browsers: Chrome: 126.0.6478.185 Safari: 17.5 npmPackages: @aws-amplify/react-native: ^1.0.28 => 1.0.28 @aws-amplify/rtn-web-browser: ^1.0.31 => 1.0.31 @aws-amplify/ui-react-native: ^2.1.4 => 2.1.5 @babel/core: ^7.20.0 => 7.24.4 @expo/vector-icons: ^14.0.0 => 14.0.0 @gorhom/bottom-sheet: ^4.6.1 => 4.6.1 @react-native-async-storage/async-storage: ^1.23.1 => 1.23.1 @react-native-community/checkbox: ^0.5.17 => 0.5.17 @react-native-community/netinfo: ^11.3.1 => 11.3.1 @react-navigation/bottom-tabs: ^6.5.20 => 6.5.20 @react-navigation/native: ^6.1.17 => 6.1.17 @react-navigation/stack: ^6.3.29 => 6.3.29 HelloWorld: 0.0.1 aws-amplify: ^6.0.27 => 6.1.4 aws-amplify/adapter-core: undefined () aws-amplify/analytics: undefined () aws-amplify/analytics/kinesis: undefined () aws-amplify/analytics/kinesis-firehose: undefined () aws-amplify/analytics/personalize: undefined () aws-amplify/analytics/pinpoint: undefined () aws-amplify/api: undefined () aws-amplify/api/server: undefined () aws-amplify/auth: undefined () aws-amplify/auth/cognito: undefined () aws-amplify/auth/cognito/server: undefined () aws-amplify/auth/enable-oauth-listener: undefined () aws-amplify/auth/server: undefined () aws-amplify/data: undefined () aws-amplify/data/server: undefined () aws-amplify/datastore: undefined () aws-amplify/in-app-messaging: undefined () aws-amplify/in-app-messaging/pinpoint: undefined () aws-amplify/push-notifications: undefined () aws-amplify/push-notifications/pinpoint: undefined () aws-amplify/storage: undefined () aws-amplify/storage/s3: undefined () aws-amplify/storage/s3/server: undefined () aws-amplify/storage/server: undefined () aws-amplify/utils: undefined () axios: ^1.6.8 => 1.6.8 babel-plugin-module-resolver: ^5.0.1 => 5.0.2 babel-plugin-transform-remove-console: ^6.9.4 => 6.9.4 eslint: ^8.57.0 => 8.57.0 expo: ~50.0.14 => 50.0.17 expo-build-properties: ~0.11.1 => 0.11.1 expo-gradle-ext-vars: ^0.1.2 => 0.1.2 expo-localization: ^14.8.4 => 14.8.4 expo-navigation-bar: ^2.8.1 => 2.8.1 expo-splash-screen: ~0.26.5 => 0.26.5 expo-status-bar: ~1.11.1 => 1.11.1 i18next: ^23.11.2 => 23.11.3 intl-pluralrules: ^2.0.1 => 2.0.1 lodash: ^4.17.21 => 4.17.21 prettier: ^3.2.5 => 3.2.5 prettier-eslint: ^16.3.0 => 16.3.0 react: 18.2.0 => 18.2.0 react-hook-form: ^7.51.4 => 7.51.4 react-i18next: ^14.1.0 => 14.1.1 react-native: 0.73.6 => 0.73.6 react-native-animated-spinkit: ^1.5.2 => 1.5.2 react-native-awesome-alerts: ^2.0.0 => 2.0.0 react-native-awesome-slider: ^2.5.2 => 2.5.2 react-native-circular-progress-indicator: ^4.4.2 => 4.4.2 react-native-collapsible: ^1.6.1 => 1.6.1 react-native-confirmation-code-field: ^7.4.0 => 7.4.0 react-native-dashed-line: ^1.1.0 => 1.1.0 react-native-dotenv: ^3.4.11 => 3.4.11 react-native-draggable-flatlist: ^4.0.1 => 4.0.1 react-native-element-dropdown: ^2.12.0 => 2.12.0 react-native-flip-card: ^3.5.7 => 3.5.7 react-native-gesture-handler: ~2.14.0 => 2.14.1 react-native-get-random-values: ^1.11.0 => 1.11.0 react-native-ionicons: ^4.6.5 => 4.6.5 react-native-linear-gradient: ^2.8.3 => 2.8.3 react-native-loading-spinner-overlay: ^3.0.1 => 3.0.1 react-native-localization: ^2.3.2 => 2.3.2 react-native-markdown-display: ^7.0.2 => 7.0.2 react-native-progress: ^5.0.1 => 5.0.1 react-native-pulse: ^1.0.7 => 1.0.7 react-native-reanimated: ~3.6.2 => 3.6.3 react-native-safe-area-context: 4.8.2 => 4.8.2 react-native-scalable-image: ^1.1.0 => 1.1.0 react-native-screens: ~3.29.0 => 3.29.0 react-native-svg: 14.1.0 => 14.1.0 react-native-swiper: ^1.6.0 => 1.6.0 react-native-user-avatar: ^1.0.8 => 1.0.8 npmGlobalPackages: eas-cli: 9.0.6 ```

Describe the bug

I am trying to wire in signInWithRedirect auth call to a react native application (expo) (using Apple and Google providers)

Used this guide: https://docs.amplify.aws/gen1/react-native/build-a-backend/auth/add-social-provider/ i followed the steps, and managed to achieve the provider sign in with Apple on an iOS device. I tried to build the project on Android, but the build fails with the following error message:

Android gradle plugin: 8.1.1 Gradle: 8.3

FAILURE: Build failed with an exception.

Expected behavior

The build should complete successfully

Reproduction steps

I have run the following commands from the projects root directory:

  1. npm install @aws-amplify/rtn-web-browser
  2. npm run android

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line › Building app... Configuration on demand is an incubating feature. > Configure project :expo Using expo modules - expo-constants (15.4.6) - expo-file-system (16.0.9) - expo-font (11.10.3) - expo-keep-awake (12.8.2) - expo-localization (14.8.4) - expo-modules-core (1.11.13) - expo-modules-core$android-annotation-processor (1.11.13) - expo-modules-core$android-annotation (1.11.13) - expo-navigation-bar (2.8.1) - expo-splash-screen (0.26.5) > Configure project :react-native-reanimated Android gradle plugin: 8.1.1 Gradle: 8.3 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:processDebugResources'. > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not resolve androidx.browser:browser:1.5.0. Required by: project :app > project :aws-amplify_rtn-web-browser > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://oss.sonatype.org/content/repositories/snapshots/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://oss.sonatype.org/content/repositories/snapshots/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://repo.maven.apache.org/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://repo.maven.apache.org/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://www.jitpack.io/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://www.jitpack.io/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://repo.maven.apache.org/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://repo.maven.apache.org/maven2/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve androidx.browser:browser:1.5.0. > Could not get resource 'https://www.jitpack.io/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Could not GET 'https://www.jitpack.io/androidx/browser/browser/1.5.0/browser-1.5.0.pom'. > Got SSL handshake exception during request. It might be caused by SSL misconfiguration > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target * 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 15s 5 actionable tasks: 5 up-to-date Error: /Users/mreti/Documents/GitHub/investmentor/android/gradlew exited with non-zero code: 1 Error: /Users/mreti/Documents/GitHub/investmentor/android/gradlew exited with non-zero code: 1 at ChildProcess.completionListener (/Users/mreti/Documents/GitHub/investmentor/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at Object.spawnAsync [as default] (/Users/mreti/Documents/GitHub/investmentor/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21) at spawnGradleAsync (/Users/mreti/Documents/GitHub/investmentor/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46) at Object.assembleAsync (/Users/mreti/Documents/GitHub/investmentor/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18) at runAndroidAsync (/Users/mreti/Documents/GitHub/investmentor/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:36:24) ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

cwomack commented 3 months ago

Hey, @mretiinteractivebrokers 👋. We've recently made some changes to the @aws-amplify/rtn-web-browser package in the latest version of Amplify (v6.4.3) that included PR #13591. While this PR doesn't specifically address the build issues you're referencing, we've been able to build on Android with React Native without any issues.

However, I do see that there's a line in the debug logs you already provided that mentions Got SSL handshake exception during request. It might be caused by SSL misconfiguration. This may be an indication that you need to renew/configure you're SSL certificates. Can you double check that?

But we'd definitely recommend upgrading to the most recent version of Amplify to get the fixes to the @aws-amplify/rtn-web-browser package mentioned above. If none of this works, can you give us any new build errors you're seeing and a debug log as well? Thank you!

mretiinteractivebrokers commented 3 months ago

Hi @cwomack ! You were completely correct, it was a certificate issue on my side. My apologies, closing the issue.