-
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
An unknown error has ocurred. #13208
Comments
import React from 'react'; import awsconfig from './src/aws-exports'; function SignOutButton() { function App() { export default withAuthenticator(App); |
Hey @KenSosa95 thanks for creating this issue! I wasn't able to reproduce this off the bat with the latest Does the error message show a stack trace, and if so could you attach the full message to the ticket (or any other logs that might be relevant)? Some more information about your project structure might also be helpful. Did you use the React Native CLI or Expo to install the dependencies? Are you building the app with iOS or Android? Please also attach your |
@KenSosa95 thanks for the info, will look into this. (FYI I edited your comment to remove some identifying info from |
Yes, I forgot to remove it. Thank you very much! |
I ran into the same problem. The tutorial page appears to have two typos. Expo CLI worked after I
with
with
|
@KenSosa95, I also want to point out that GitHub keeps all versions of a post publicly available (at least I can access them). You may want to delete your post if you want to protect confidential information. |
Hi, @miranska thanks for the advice, I will delete it and post it again after this one. |
Hi @esauerbo thanks for replying. I used both. I tried first with React Native CLI and it didn't work, then I started from scratch with Expo and it doesn't work either. It does not show any error message in the terminal. Only shows the message in the device as it is in the picture attached. When I open Amazon Cognito the user appears registered. Confirmation status: Confirmed. Status: Enabled This is the package.json: This is the aws-exports.js: const awsmobile = { export default awsmobile; |
@KenSosa95 can you add a function override to import React from 'react';
import { Button } from 'react-native';
import { signIn, SignInInput } from 'aws-amplify/auth';
import { Authenticator, useAuthenticator } from '@aws-amplify/ui-react-native';
import { Amplify } from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
function SignOutButton() {
const { signOut } = useAuthenticator();
return <Button onPress={signOut} title="Sign Out" />;
}
const services = {
async handleSignIn(input: SignInInput) {
try {
const user = await signIn(input);
console.log(user);
return user;
} catch (error) {
console.error(error)
}
},
};
function App() {
return (
<Authenticator.Provider>
<Authenticator services={services}>
<SignOutButton />
</Authenticator>
</Authenticator.Provider>
);
}
export default App; |
@esauerbo I just made some changes to the SignIn fuction because I am using js. import { Authenticator, useAuthenticator } from '@aws-amplify/ui-react-native';
import { Amplify } from 'aws-amplify';
import { signIn } from 'aws-amplify/auth';
import React from 'react';
import { Button } from 'react-native';
import awsconfig from './src/aws-exports';
Amplify.configure(awsconfig);
function SignOutButton() {
const { signOut } = useAuthenticator();
return <Button onPress={signOut} title="Sign Out" />;
}
const services = {
async handleSignIn(input) {
try {
const user = await signIn(input);
console.log(user);
return user;
} catch (error) {
console.error(error);
}
},
};
function App() {
return (
<Authenticator.Provider>
<Authenticator services={services}>
<SignOutButton />
</Authenticator>
</Authenticator.Provider>
);
}
export default App; In the device I get a Console warning: Possible unhandled promise rejection (id:2): The message I get in the terminal is the same. ERROR [Unknown: An unknown error has occurred. |
Good morning from London. Quickly update. |
@KenSosa95 Good morning! Glad to hear it's working on web. Thanks for your patience on this, I have a couple of followup questions:
import React from 'react';
import { Button, StyleSheet, View } from 'react-native';
import { signIn } from 'aws-amplify/auth';
import { Amplify } from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
async function handleSignIn(input) {
try {
const user = await signIn(input);
console.log(user);
return user;
} catch (error) {
console.error(error);
console.error(error.underlyingError);
}
}
const style = StyleSheet.create({
container: { flex: 1, alignItems: 'center', justifyContent: 'center' },
});
function App() {
return (
<View style={style.container}>
<Button
onPress={() =>
handleSignIn({
username: 'your-username',
password: 'your-password',
})
}
title="Sign In"
/>
</View>
);
}
export default App; |
System:
Do I have to eject it? In the tutorial does not say anything about that. |
Since the issue here appears to be with the |
Hello, @KenSosa95 👋 and thanks for the details you've already provided on this issue. We'll take a look at it and see if we can reproduce as well as follow up with any questions we have from the Looks to be related to the #13200 I've linked above as well. |
Hi, @cwomack, thanks for replying. I guess the problem is related with Expo go |
@KenSosa95 Was able to reproduce the issue in an expo project without using expo go and believe the root cause to be a missing React Native polyfill dependency. Can you try adding npx expo install react-native-get-random-values then rebuilding android: npx expo run:android |
@KenSosa95, let us know when you get a chance to review @calebpollman's comment above and if it helps resolve the issue. Thanks! |
@calebpollman @cwomack react-native-get-random-values is already installed. Thanks for the help! |
@KenSosa95, can see if passing the |
Good night people! I hope everyone is well. Message from Brazil, thanking the strong community we have here. I was experiencing the same problem reported above, finally after testing it on the web, I was able to log in. Using the iOS device or Android emulator, it is not possible to log in, only register and recover. Now we can continue with our projects. |
Glad to hear you were able to get unblocked @bertoninicolas. @KenSosa95, are you still experiencing this? |
@cwomack When I run npx expo start I am still not able to log in. |
@cwomack Hey, I've been doing something somewhat similar, that I think is related. I'm essentially using the bare signIn function for a custom auth flow in my expo/react-native app with I think its just expo go related as its no longer supported. |
Adding some more on this. I just done the tutorial today and had the above issues. Also had to use |
Same issue ERROR [Unknown: An unknown error has occurred.]
ERROR [Error: The package '@aws-amplify/react-native' doesn't seem to be linked. Make sure: |
You can always look at |
For anyone that comes across this issue or is still experiencing this, we've updated our docs within the Quickstart guide and other areas per this PR in the docs repo to clarify that we no longer have support for Expo Go. There's also the helpful comment above from @calebpollman to help clarify how to resolve the missing polyfill for We'll close this issue as resolved at this point. |
Hi, I am following the tutorial to implement authentication for my mobile app created with react native. It allows me to sign up and reset password but when I try to sign in it shows me this message: "An unknown error has occurred."
I have installed everything how it says and I have done this multiple times starting from scratch and still getting the same issue.
The text was updated successfully, but these errors were encountered: