amplify-js: Auth.signIn takes too long to execute

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

# Put output below this line

  System:
    OS: Windows 10 10.0.22621
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 3.35 GB / 15.37 GB
  Binaries:
    Node: 18.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.6.1 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.12 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Spartan (44.22621.2134.0), Chromium (115.0.1901.203)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @babel/core: ^7.20.0 => 7.22.10
    @react-native-async-storage/async-storage: 1.18.2 => 1.18.2
    @react-native-community/netinfo: 9.3.10 => 9.3.10
    HelloWorld:  0.0.1
    aws-amplify: ^5.3.8 => 5.3.8
    expo: ~49.0.7 => 49.0.7
    expo-status-bar: ~1.6.0 => 1.6.0
    react: 18.2.0 => 18.2.0
    react-native: 0.72.3 => 0.72.3
  npmGlobalPackages:
    @aws-amplify/cli: 12.3.0
    @expo/ngrok: 4.1.1
    corepack: 0.17.0
    eas-cli: 4.1.2
    npm: 9.5.1
    sharp-cli: 2.1.0


Describe the bug

Login process takes an excessive amount of time (15 - 30 seconds) and causes the interface to freeze

Expected behavior

The login process should be swift, typically completing within a few seconds. Additionally, the user interface should remain responsive at all times

Reproduction steps

  1. Create an Expo application.
  2. Configure Amplify.
  3. Launch the application using expo go app.

Code Snippet

// Put your code below this line.
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View, Button } from 'react-native';
import { Amplify, Auth } from "aws-amplify";
import awsConfig from "./src/aws-exports";

Amplify.configure(awsConfig);
Amplify.Logger.LOG_LEVEL = "VERBOSE"


export default function App() {

  async function onSignInPressed() {
    console.log("onSignInPressed", new Date());

    await Auth.signIn("someLogin", "somePassword");

    console.log("onSignInPressed end", new Date());
  }

  return (
    <View style={styles.container}>

      <Button title="Sign In" onPress={() => onSignInPressed()} />

      <StatusBar style="auto" />
    </View>
  );
}


https://github.com/dipsx/amplifyAuthTestBug

Log output

// Put your logs below this line

 LOG  onSignInPressed 2023-08-21T23:07:30.563Z
 LOG  [DEBUG] 07:45.747 AuthClass - signIn failure [UserNotFoundException: User does not exist.]

aws-exports.js


const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_cognito_identity_pool_id": "us-east-1:7d271968-d377-4a2f-bc26-e312a58b9998",
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": "us-east-1_KA64H7czB",
    "aws_user_pools_web_client_id": "598vgu2f26bhv9omr5qdd8b4ee",
    "oauth": {},
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "EMAIL"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [
        "SMS"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ]
};

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

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 4
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Hello everyone, We are investigating this and we will get back to you ASAP.

@kvnlnt, @therealkh, and @asp3, we’ve released another update that (hopefully) will resolve this. Can any of you confirm if upgrading to v5.3.10 now resolves the issue?

issue fixed on aws-amplify@5.3.10

The release containing this fix is out. Please upgrade to the latest version and verify that the problem you where experiencing has been fixed.

looks like it drops JS thread fps

@dipsx and @kvnlnt, would you both please see if deleting your node_modules folder along with your package-lock.json file (if you have one), then reinstalling dependencies by running npm install fixes things? Just want to have you try those steps before we reopen!

That was the first thing I tried when the update failed to work. Still taking >30sec on both IOS and Android. I also blew away any/all cache, temp, build files, etc and completely reinstalled the app more than once. Just did it again, still > 30sec…currently ~40sec.

same here, down to under 3 seconds! Thanks for the quick fix @cwomack

@cwomack confirmed, issue is resolved. Now resolving in ~3sec which has been the norm. Much appreciated!