-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
React Native - signIn [Unknown: An unknown error has ocurred.] #12593
Comments
Im also getting this on the confirmSignIn after a successful challenge response - working fine in v5 and no change to CUSTOM_CHALLENGE |
Hi guys I'm also getting this error, I've installed a fresh expo49 app and only the aws amplify to test it, and I got this error signing in [Unknown: An unknown error has ocurred.] Also today I've tried the new versions: Still the same problem. Thx |
Hello @mtergel , @joaobsantos . Sorry to hear you are having issues with the |
hello @steve-calverley . Sorry about the issues with the |
Hi @israx , heres the log : signing in undefined Maybe its not iniatializing Amplify.configure?! |
@joaobsantos can you screenshot the error please ? |
Something I forgot @joaobsantos , just for testing purposes only. Can you call the
This will change the actual auth flow type. However we recommend using the default flow which is SRP. Let me know if that ends up working please. |
@israx here it is: |
Sorry my mistake. It should be |
Error signing in: [Error: The package '@aws-amplify/react-native' doesn't seem to be linked. Make sure:
I have "@aws-amplify/react-native": "^1.0.4", installed... |
can you delete |
I've already done that, but im using expo with expo go and I follow your docs... I dont have to build a development app... I mean in verwsion 4 everything worked great... Only in 5 and 6 I get this problem. I dont know. |
Hi @mtergel can you confirm that you have installed |
Hi @nadetastic , I can confirm that I have in mine: "dependencies": { |
@israx Console Log - [TypeError: Cannot read property 'setTokens' of undefined] Upgrade to 6.0.4 and removed lock etc |
@steve-calverley what are your dependencies ? Wondering if |
@israx Deps "dependencies": { |
Can you shared a redacted example of how you are importing, configuring and calling the APIs? |
On the code that you shared I think the |
@mtergel can you share your app |
@elorzafe two functions we use - very rough for testing this issue const signIn = async (username: string) => {
try {
const signInResult = await AWSSignIn({
username,
options: {
authFlowType: 'CUSTOM_WITHOUT_SRP',
},
});
console.log('signInResult', signInResult);
const {isSignedIn, nextStep} = signInResult;
if (isSignedIn) {
return initSignIn();
}
switch (nextStep.signInStep) {
case 'CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE':
break;
case 'CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED':
// return signInResult;
break;
case 'RESET_PASSWORD':
break;
default:
console.log(nextStep.signInStep);
throw new Error('Not a Sign In Event we handle');
}
} catch (error: unknown) {
console.log('ERROR::useCognitoUser::signIn:: ', error);
throw error;
}
};
const sendCustomChallengeAnswer = async (
answer: string,
): Promise<AuthUser | any> => {
let user;
try {
console.log('answer', answer);
const confirmSignInOutput = await AWSConfirmSignIn({
challengeResponse: answer,
});
console.log('confirmSignInOutput', confirmSignInOutput);
if (!confirmSignInOutput.isSignedIn) {
throw new Error('Incorrect Answer. Please try again');
}
user = await getCurrentUser();
console.log('user', user);
return user;
} catch (error: unknown) {
if (!user) {
console.log(
'ERROR::useCognitoUser::sendCustomChallengeAnswer:: ',
error,
);
throw new Error('Unable to sign in');
}
}
}; First function is called on screen that obtains phone number -> move to send screen to enter answer -> 2nd function is called. Config import amplifyconfig from './src/amplifyconfiguration.json';
Amplify.configure(amplifyconfig); |
Thanks guys, we were using nx monorepo, it seemed we need to import react-native-get-random-values to the package.json for our app.
|
@elorzafe Should I open a new ticket for my issue. Have just upgrade packages |
@elorzafe sorry, you are right, and now it works... Thx for your time to help me I really apreciate and keep up the good work.
|
Hi @elorzafe sorry to bother you again, in my clean expo49 it works but then when I do the same thing in my monorepo I get this error right on openning the app (app doesnt work): ERROR Error: The package '@aws-amplify/react-native' doesn't seem to be linked. Make sure:
I have "@aws-amplify/react-native": "^1.0.4", installed. If I go to the version that I had before, "aws-amplify": "4.3.43" it works fine... |
@steve-calverley please do open a new issue so we can keep track of the |
@joaobsantos Amplify JS currently doesn't support Expo Go as we are now requiring the use of more native modules to leverage native functionality. Is it possible for you to use the RN CLI instead ? And if you don't mind, can you open an issue with us ? So we can keep track of this issue too. |
@israx but in a clean expo49 project with expo go, works. |
feel free to open a new issue but I am still not sure why |
@joaobsantos happy to help! We have that setting explained on Switch Authentication Flows docs Let me know if that clarifies your concerns! |
@elorzafe Running on both iOS and Android emulators. Let me look into Async Config before opening new issue |
Hi @elorzafe , After you pointed me out I went to that link and understood what was happening. In my opinion the documentation example in signIn should have a reference to that and this code in the example:
|
I'm having the same problem after testing some tips proposed here. "An unknown error has occurred" at the time of login, with account creation and email verification carried out successfully.
I tried using expo go on my iPhone, I used expo go on an android emulator, and none of them work |
Were you able to figure this out? I have the same issue. |
I still use v5.2.2, it was faster then dealing with this... |
I am having the same "an unknown error occurred" on my expo react native app. Does anyone have any suggestions? |
Yes, same here I also get this error. @bertoninicolas, I guess even you're developing a food delivery app by following the 5 hours playlist on YT? |
Docs say you cannot use Expo Go Unfortunately you have to:
In my opinion Expo Go should be supported, there is no reason why native code is necessary, at least the error message should be easier to understand |
I had the same problem
I tried everything from updating packages, creating new development builds, creating entirely new amplify projects. The problem started when I did Then I checked into api gateway, and lo and behold, my Cognito authorizers were missing! Back in my app, I tried signing in const signInRes = await signIn({
username: "[email protected]",
password: "PassWord123",
}); Error: I tried adding options const signInRes = await signIn({
username: "[email protected]",
password: "Aunto1044",
options: {
authFlowType: "USER_AUTH", // 'USER_PASSWORD_AUTH'
},
}); Error: I thought my user might have had a problem, so i deleted that user and signed up, confirm sign up (everything in the simple/normal way) and signup flow works! But again signing in produces the same error Like @joaobsantos and @elorzafe suggested, I read up on the docs: I headed to Cognito and and for both of these options: You must enable Username and Password If you dont see it included, click Edit and check the box: Then save changes Future notes:
|
@raihanNoman Thanks for the updated explanation, it works. 👍 |
As I wasn't able to make it work with Amplify. I used GCP Firebase instead and it was way easier. Firebase also provides hosting. You can find my repository. I created a 3 app food delivery module (Uber eats replica) following a YT series. @MuhammadAflah |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
getting error [Unknown: An unknown error has ocurred.] only when calling signIn
Expected behavior
signIn to work
Reproduction steps
call signIn
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
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
The text was updated successfully, but these errors were encountered: