Skip to content

"An unknown error has occurred" when trying to sign in app

0

hi, I'm making an app using react native and I'm using the amplify authentication to be able to create accounts and log in etc... my problem is that the accounts are creating well but when I try to sign in with the username and password it shows an error message: "An unknown error has occurred". I asked a friend and he told me it's because expo go doesn't work with amplify . and when I tried opening the app through web it really worked but there are things i wan't to test through mobile . so I tried doing it in a bare react native app but it still showed the same error. of course I made sure also to see that the account is really made and verified , and it did work when i opened through web . so I'd like to know how to fix this so it works on my mobile device too

i'm using android device plugged to the computer and run "npx react-native run-android"

here's my code: import React from 'react'; import { SafeAreaView, Text, } from 'react-native'; import { Amplify } from 'aws-amplify'; import { Authenticator } from '@aws-amplify/ui-react-native'; import outputs from '../CardioActive/src/amplify_outputs.json';

Amplify.configure(outputs);

const App = () => { return ( <Authenticator.Provider> <Authenticator> <SafeAreaView> <Text>hello</Text> </SafeAreaView> </Authenticator> </Authenticator.Provider> ); };

export default App;

Enter image description here

asked a year ago800 views
2 Answers
3

Worth considering on below:

  • Use npx expo run:android: Instead of using npx react-native run-android, try running your app with npx expo run:android. This command is recommended for running React Native apps with Amplify.

  • Check Amplify Version Compatibility: Ensure that you're using a compatible version of Amplify with Expo. As of Amplify v6, there are known compatibility issues with Expo Go. You might need to use a different method to run your app on a physical device.

  • Native Modules: Amplify requires native modules that are not available through the Expo SDK. This means that while you can still use Expo, you might need to switch to a bare React Native project for full functionality.

  • Update Dependencies: Make sure all your dependencies are up-to-date and correctly linked. Run pod install if you're using CocoaPods and rebuild your app after installing the packages.

  • Check Network Permissions: Ensure that your app has the necessary permissions to access the network. This can sometimes cause issues with authentication.

  • Debugging: Use debugging tools to check if there are any network requests being made when you try to sign in. This can help identify if the issue is on the client side or server side.

EXPERT
answered 9 months ago
0

did you ever resolve this issue? i'm getting the same error. this only happens on mobile. web, i can login with no problems but i get this error on both ios and android. i didn't a fresh install with the instructions outlined here: https://docs.amplify.aws/react-native/start/quickstart/

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.