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

AWS Amplify requires amazon-cognito-identity-js in managed EAS Build #756

Closed
timhbt opened this issue Nov 11, 2021 · 10 comments
Closed

AWS Amplify requires amazon-cognito-identity-js in managed EAS Build #756

timhbt opened this issue Nov 11, 2021 · 10 comments
Assignees
Labels

Comments

@timhbt
Copy link

timhbt commented Nov 11, 2021

Summary

When using Auth.signIn(), no requests go out and it loads infinitely.
Backend url is secure (https).

The same code works with classic build (expo build) and expo publish.

Environment

EAS CLI 0.35.0 environment info:
System:
OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.18.1 - /usr/bin/node
Yarn: 1.22.15 - /usr/bin/yarn
npm: 6.14.15 - /usr/bin/npm
Utilities:
Git: 2.25.1 - /usr/bin/git
npmPackages:
expo: ^43.0.2 => 43.0.2
expo-cli: 4.13.0 => 4.13.0
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1

Error output

Error in adb logcat
grafik

Reproducible demo or steps to reproduce from a blank project

import { Auth } from 'aws-amplify'

const handleSignIn = async () => {
  Auth.signIn(email, password).then(resp => console.log(resp)
}
@timhbt timhbt added the bug Something isn't working label Nov 11, 2021
@basit3407
Copy link

basit3407 commented Nov 12, 2021

I am having almost same issue for signing in via google. my reproducible example is as fellow:

  import * as GoogleSignIn from "expo-google-sign-in";

   const googleSignIn =async () => {

   try {
   const token = await _signInAsyncGoogle();

 //here i send this token to my backend
  } catch (e) {

await GoogleSignIn.signOutAsync();

  }
 };


 const _signInAsyncGoogle = async () => {
//Configures how the GoogleSignIn module will attempt to sign in.
//We arent providing any options. It will configure from google.json file downloaded from firebase
try {
await GoogleSignIn.initAsync();

//Android Only, this method always returns true on iOS
//This method will present a modal for the user to update Play Services if they aren't already up-to-date.
//Returns true after the user successfully updates.
Platform.OS == "android" && (await GoogleSignIn.askForPlayServicesAsync());
//Starts the native authentication flow with the information provided in GoogleSignIn.initAsync()
const { user } = await GoogleSignIn.signInAsync();
const token = user?.auth?.idToken;
return token;
  } catch (error) {
console.log("error in google = ", error);
   }
};

This worked perfectly fine in classic expo build. but since i migrated to eas no request is being sent to backend server

@basit3407
Copy link

basit3407 commented Nov 12, 2021

here is my example project. team expo can clone and test it. https://github.com/basit3407/expo-google-signInTest

@timhbt
Copy link
Author

timhbt commented Nov 12, 2021

It works for me now.
Looked a bit deeper with expo-dev-client and become this error:
[Unhandled promise rejection: Error: Error: Could not find a native getRandomBase64 implementation. Validate that amazon-cognito-identity-js is linked.]

So I had to install cognito-identity-js contradictory to the aws tutorial unter tap Expo.
But I don't know why it works before with expo build without installing this library.

@timhbt timhbt changed the title no request go out to backend no request goes out to backend Nov 13, 2021
@brentvatne
Copy link
Member

brentvatne commented Nov 16, 2021

@TimHubert - on expo build we include the native code for amazon-cognito-identity-js. it seems like we need to update the aws tutorial to provide more information on this. we may also want to add this to our migration guide

@brentvatne brentvatne changed the title no request goes out to backend [docs] AWS Amplify requires amazon-cognito-identity-js in managed EAS Build Nov 16, 2021
@brentvatne brentvatne self-assigned this Nov 16, 2021
@brentvatne brentvatne added docs and removed bug Something isn't working labels Nov 16, 2021
@brentvatne brentvatne changed the title [docs] AWS Amplify requires amazon-cognito-identity-js in managed EAS Build AWS Amplify requires amazon-cognito-identity-js in managed EAS Build Nov 16, 2021
@orome
Copy link

orome commented May 18, 2022

The AWS Amplify docs still don't explain any of this, nor FWIW do they explain how to get DataStore working (which I have now wasted three days trying to do).

@brentvatne
Copy link
Member

@orome - you may want to post an issue about this on aws amplify docs. feel free to ping me in the issue and let them know that I am happy to help them improve the docs

@mikeRChambers610
Copy link

@brentvatne the doc you shared says we need to link the package? Can we do this with managed builds?

@timhbt
Copy link
Author

timhbt commented Sep 12, 2022

@mikeRChambers610 It's automatically linked. You only need to install the package amazon-cognito-identity-js.

@popoviciyoel
Copy link

It works for me now. Looked a bit deeper with expo-dev-client and become this error: [Unhandled promise rejection: Error: Error: Could not find a native getRandomBase64 implementation. Validate that amazon-cognito-identity-js is linked.]

So I had to install cognito-identity-js contradictory to the aws tutorial unter tap Expo. But I don't know why it works before with expo build without installing this library.

did you resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants