AWS Amplify v6 "deepFreeze" TypeError with Expo + Hermes - signIn fails but signUp works
17:49 16 Nov 2025

I'm a beginner working on a React Native app and facing a confusing issue with AWS Amplify v6 authentication.
I'm just trying to build a simple app that allows to connect into a personnal space, in order to familiarize with AWS authentications features.

Setup

  • Expo SDK 54 with expo-router v6

  • AWS Amplify v6.15.8 (Gen 1 CLI)

  • React Native 0.81.5

  • Amazon Cognito for authentication

The Problem

Signup is correctly working (user is created on AWS Cognito backend), but when I try to sign in, I get this error:

ERROR [TypeError: Restricted in strict mode]

Call Stack:
  deepFreeze (node_modules\@aws-amplify\core\dist\cjs\utils\deepFreeze.js)
  AmplifyClass#configure (node_modules\@aws-amplify\core\dist\cjs\singleton\Amplify.js)

 WARN  Amplify has not been configured. Please call Amplify.configure() before using this service.
 ERROR  ❌ Erreur de connexion: [Unknown: An unknown error has occurred.] 

Strange behavior:

  • ❌ signIn() fails with "Amplify not configured"

  • ✅ signUp() and confirmSignUp() work perfectly

Configuration

index.js (entry point):

import 'react-native-get-random-values';
import 'react-native-url-polyfill/auto';
import './amplifyConfig';
import 'expo-router/entry';

amplifyConfig.ts:

import { Amplify } from 'aws-amplify';
import awsconfig from './aws-exports';

Amplify.configure({
  Auth: {
    Cognito: {
      userPoolId: awsconfig.aws_user_pools_id,
      userPoolClientId: awsconfig.aws_user_pools_web_client_id,
      // ... other config
    },
  },
});

login.tsx (not working on Android / iOS ; working on web):

// app/login.tsx
import { getCurrentUser, signIn } from 'aws-amplify/auth';
import { useRouter } from 'expo-router';
import React, { useState } from 'react';
import { Alert, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';

export default function LoginScreen() {
  const router = useRouter();
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');
  const [loading, setLoading] = useState(false);

  const handleLogin = async () => {
    if (!email || !password) {
      Alert.alert('Erreur', 'Veuillez remplir tous les champs');
      return;
    }

    setLoading(true);
    try {
      // Connexion avec Amplify v6
      const { isSignedIn, nextStep } = await signIn({
        username: email.toLowerCase().trim(),
        password,
      });

      if (isSignedIn) {
        // Récupérer les infos utilisateur
        const user = await getCurrentUser();
        console.log('✅ Connexion réussie:', user.username);
        router.replace('/welcome');
      } else if (nextStep.signInStep === 'CONFIRM_SIGN_UP') {
        // L'utilisateur doit confirmer son email
        Alert.alert('Confirmation requise', 'Veuillez confirmer votre email avant de vous connecter');
        router.push('/confirm-email');
      }
    } catch (error: any) {
      console.error('❌ Erreur de connexion:', error);
      
      let message = 'Une erreur est survenue';
      if (error.name === 'NotAuthorizedException') {
        message = 'Email ou mot de passe incorrect';
      } else if (error.name === 'UserNotFoundException') {
        message = 'Aucun compte trouvé avec cet email';
      } else if (error.name === 'UserNotConfirmedException') {
        message = 'Veuillez confirmer votre email';
        router.push('/confirm-email');
      }
      
      Alert.alert('Erreur de connexion', message);
    } finally {
      setLoading(false);
    }
  };

  return (
    
      Connexion

      

      

      
        
          {loading ? 'Connexion...' : 'Se connecter'}
        
      

       router.push('/signup')}>
        Créer un compte
      

       router.push('/forgot-password')}>
        Mot de passe oublié ?
      
    
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 20,
    justifyContent: 'center',
    backgroundColor: '#fff',
  },
  title: {
    fontSize: 28,
    fontWeight: 'bold',
    marginBottom: 30,
    textAlign: 'center',
  },
  input: {
    borderWidth: 1,
    borderColor: '#ddd',
    borderRadius: 8,
    padding: 15,
    marginBottom: 15,
    fontSize: 16,
  },
  button: {
    backgroundColor: '#007AFF',
    padding: 15,
    borderRadius: 8,
    marginTop: 10,
  },
  buttonDisabled: {
    backgroundColor: '#ccc',
  },
  buttonText: {
    color: '#fff',
    textAlign: 'center',
    fontSize: 16,
    fontWeight: '600',
  },
  link: {
    color: '#007AFF',
    textAlign: 'center',
    marginTop: 15,
    fontSize: 14,
  },
});

signup.tsx (working everywhere)

// app/signup.tsx
import { signUp } from 'aws-amplify/auth';
import { Link, useRouter } from 'expo-router';
import React, { useState } from 'react';
import { Alert, Button, StyleSheet, Text, TextInput, View } from 'react-native';

export default function SignUpScreen() {
  const router = useRouter();
  const [givenName, setGivenName] = useState('');
  const [familyName, setFamilyName] = useState('');
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');
  const [loading, setLoading] = useState(false);

  const handleSignUp = async () => {
    if (!givenName || !familyName || !email || !password) {
      Alert.alert('Erreur', 'Veuillez remplir tous les champs');
      return;
    }

    if (password.length < 8) {
      Alert.alert('Erreur', 'Le mot de passe doit contenir au moins 8 caractères');
      return;
    }

    setLoading(true);
    try {
      // ✅ Nouvelle syntaxe Amplify v6
      const { isSignUpComplete, nextStep } = await signUp({
        username: email.toLowerCase().trim(),
        password,
        options: {
          userAttributes: {
            email: email.toLowerCase().trim(),
            given_name: givenName.trim(),
            family_name: familyName.trim(),
          },
        },
      });

      console.log('✅ Inscription réussie, étape suivante:', nextStep);

      if (nextStep.signUpStep === 'CONFIRM_SIGN_UP') {
        Alert.alert(
          'Code envoyé',
          'Un code de confirmation a été envoyé à votre email',
          [
            {
              text: 'OK',
              onPress: () => router.push('/confirm-email'),
            },
          ]
        );
      }
    } catch (error: any) {
      console.error('❌ Erreur d\'inscription:', error);
      
      let message = 'Une erreur est survenue';
      if (error.name === 'UsernameExistsException') {
        message = 'Un compte existe déjà avec cet email';
      } else if (error.name === 'InvalidPasswordException') {
        message = 'Le mot de passe ne respecte pas les critères de sécurité';
      } else if (error.name === 'InvalidParameterException') {
        message = 'Paramètres invalides. Vérifiez vos informations';
      } else if (error.message) {
        message = error.message;
      }
      
      Alert.alert('Erreur d\'inscription', message);
    } finally {
      setLoading(false);
    }
  };

  return (
    
      Créer un compte

      Prénom
      

      Nom
      

      Email
      

      Mot de passe (min. 8 caractères)
      

      

Question

Why does signUp() work but signIn() doesn't if Amplify isn't configured?

Any help would be greatly appreciated!

amazon-web-services react-native expo amazon-cognito aws-amplify