amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Add EAS Build Support for AmplifyJS

Open amol9372 opened this issue 3 years ago • 3 comments

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

# Put output below this line

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 3.03 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  Browsers:
    Chrome: 98.0.4758.102
    Safari: 15.3
  npmPackages:
    @babel/core: ^7.12.9 => 7.16.0
    @react-native-async-storage/async-storage: ~1.15.0 => 1.15.17
    @react-native-community/masked-view: ^0.1.11 => 0.1.11
    @react-native-community/netinfo: ^6.2.1 => 6.2.1
    @react-native-picker/picker: ^2.2.1 => 2.2.1
    @react-navigation/native: ^6.0.6 => 6.0.6 (3.8.4)
    @react-navigation/native-stack: ^6.2.5 => 6.2.5
    HelloWorld:  0.0.1
    amazon-cognito-identity-js: ^5.2.6 => 5.2.6
    aws-amplify: ^4.3.14 => 4.3.14
    aws-amplify-react-native: ^6.0.2 => 6.0.2
    axios: ^0.24.0 => 0.24.0 (0.21.4)
    axios-debug-log: ^0.8.4 => 0.8.4
    expo: ~43.0.2 => 43.0.5
    expo-linking: ~2.4.2 => 2.4.2
    expo-modules-core: ~0.4.10 => 0.4.10
    expo-notifications: ~0.13.3 => 0.13.3
    expo-permissions: ~13.0.3 => 13.0.3
    expo-status-bar: ~1.1.0 => 1.1.0
    expo-updates: ~0.10.15 => 0.10.15
    expo-web-browser: ~10.0.3 => 10.0.3
    hermes-inspector-msggen:  1.0.0
    react: 17.0.1 => 17.0.1
    react-dom: 17.0.1 => 17.0.1
    react-moment: ^1.1.1 => 1.1.1
    react-native: 0.64.3 => 0.64.3
    react-native-config: ^1.4.5 => 1.4.5
    react-native-device-info: ^8.4.8 => 8.4.8
    react-native-dotenv: ^3.3.1 => 3.3.1
    react-native-dropdown-picker: ^5.3.0 => 5.3.0
    react-native-elements: ^3.4.2 => 3.4.2
    react-native-form-validator: ^0.5.1 => 0.5.1
    react-native-safe-area-context: 3.3.2 => 3.3.2
    react-native-screens: ~3.8.0 => 3.8.0
    react-native-selection-group: 2.0.0 => 2.0.0
    react-native-toast-message: ^2.1.1 => 2.1.1
    react-native-web: 0.17.1 => 0.17.1
    react-navigation: ^4.4.4 => 4.4.4
    react-navigation-header-buttons: ^8.0.0 => 8.0.0
    react-navigation-stack: ^2.10.4 => 2.10.4
    react-navigation-tabs: ^2.11.1 => 2.11.1
  npmGlobalPackages:
    corepack: 0.10.0
    eas-cli: 0.47.0
    expo-cli: 5.1.2
    npm: 8.1.2

Describe the bug

I am trying to install a standalone apk on my Android Device with EAS build. The apk is generated and the application also opens. But on any operation on the Amplify Auth UI, it says "Authentication Error". no matter what the credentials are. It works completely fine with the classic expo build

I have added the necessary amazon-cognito-identity-js which is required for EAS build The application is running fine on emulators and expo-go client but apk is failing.

Expected behavior

The app should be able to login or give appropriate errors if the credentials are incorrect

Reproduction steps

  1. Configure eas.json and add a build profile "preview": { "android": { "buildType": "apk" } }

  2. Run eas build -p android --profile preview

  3. Install apk on device or emulator

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

const awsmobile = {
    "aws_project_region": "ap-south-1",
    "aws_cognito_identity_pool_id": "ap-south-1:9a33eabd-*************",
    "aws_cognito_region": "ap-south-1",
    "aws_user_pools_id": "ap-south-1_******",
    "aws_user_pools_web_client_id": "6ut3183km********",
    "oauth": {},
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "EMAIL",
        "PHONE_NUMBER"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [
        "SMS"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ]
};

export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

OnePlus 8 pro

Mobile Operating System

Android 11

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

Screenshot_20220217-192801

amol9372 avatar Feb 17 '22 14:02 amol9372

@amol9372 Thanks for opening and bringing awareness to Amplify of this issue. As we do not officially support EAS build at this time I am labeling this as a feature request. Please let us know if you would be interested in implementing!

calebpollman avatar Feb 18 '22 00:02 calebpollman

I'm also having this issue with EAS builds but for iOS as well, EAS build support would be nice. It is odd that everything except login works perfectly fine with EAS builds

pjsandwich avatar Apr 18 '22 18:04 pjsandwich

@pjsandwich Were you able to solve the issue? I'm having the same problem with EAS builds for iOS

Andrea-Vigano avatar Aug 04 '22 08:08 Andrea-Vigano

I am concerned that "add EAS build support" is turning into some type of catch-all for "Expo/EAS and Amplify don't work together"?

What would it mean to "officially support EAS build"? Is the suggestion that AWS Amplify does not support React Native? Or what specifically about EAS build (a standardized way to build the "native app" part of a React Native project) is "not working" with Amplify?

Seems to me the OP is having issues with Authentication? I'd recommend that more details about the specific authentication configuration and issue be investigated.

I know there are people using EAS Build + Amplify without issue.

gregfenton avatar Jan 31 '23 17:01 gregfenton

^^ Not sure if OP found a solution but following the current authentication docs works perfectly fine:

Here's an auth example with SSO enabled from a react context: https://github.com/pjsandwich/sso-context

pjsandwich avatar Jan 31 '23 17:01 pjsandwich

@amol9372 Following up here, I can confirm that using Amplify Auth works as expected - can you clarify which version of Amplify UI you are using?

nadetastic avatar Mar 09 '23 06:03 nadetastic

Are there any updates on this? A way to work with amplify and EAS?

121Unicorns avatar Aug 07 '23 08:08 121Unicorns

Hi @121Unicorns could you share what errors or issues you are facing when trying to using Amplify with EAS? Most of what I have tried so far gets me a working setup.

nadetastic avatar Sep 13 '23 03:09 nadetastic

With the release of the latest major version of Amplify (aws-amplify@>6), this issue should now be resolved! Please refer to our release announcement, migration guide, and documentation for more information.

cwomack avatar Dec 11 '23 18:12 cwomack