-
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
The react native app shows an error when we've implemented the sign in & sign out #13621
Comments
Hey @HuiSF I've seen that you recently worked on someone's problem that involves AWS authentication with React Native and I would like you to help me please if you can. I've been facing this problem for days and the project has a deadline to be completed. |
Hello, @Tructivity and sorry to hear you're running into this. Are you able to provide a full stack trace of the error so we can better determine the root cause (just a screenshot of this would be helpful). Also, can you share a code snippet or just an example shape of what your Also want to confirm that when you mention that you're trying to "link the existing backend resources" for Auth, have you seen this reference in the docs for setting up backend resources (then looking under the "Existing Resources" tab)? |
@cwomack Here’s an example of how import Amplify from 'aws-amplify';
import awsconfig from './src/aws-exports';
try {
Amplify.configure(awsconfig);
console.log("Amplify configured successfully.");
} catch (error) {
console.error("Amplify configuration error:", error);
} |
Hi @Tructivity the code seems incorrect: import Amplify from 'aws-amplify';
// should be
import { Amplify } from 'aws-amplify'; I noticed that you were not using Typescript in your react-native project, is there a specific reason for doing so? |
Hey @HuiSF I'm so lucky I've found someone like you, the problem has been resolved. My developer told me that he just learned it on JavaScript instead of Typescript. Is there any disadvantage of that? Also, he asked me if you can please provide the code of the sign in that hold only email and password for just checking that he did the code right. For safety only! |
@Tructivity, happy to hear that @HuiSF's comment helped unblock you! As for the questions above, you can refer to our docs on the Let us know if there are further questions or blockers from here. |
Hey @cwomack so now I'm moving to the CRUD operation so the first thing I should do it this "Set up Amplify GraphQL API" then move to this "Create, update, and delete application data" right? Does this automatically implement datastore in the React Native app so I have offline use of the app? or I should implement another thing? I saw this one called "Connect your app code to the API" but didn't understand what's the benefits of it. Can u please explain? Do I need it in this scenario? |
Hey @HuiSF can u please answer the above questions? I've been waiting the whole day and the project's deadline is close! |
Hey @chrisbonifacio can u please answer my question above? I'm waiting but no one is answering me! I've seen you worked on graphql issue few days ago so I tagged you here! |
Hey @cwomack I'm waiting for ur answer, can u please help? |
@Tructivity, apologize for the delayed reply here. There's a few questions within the comments above, so but can you possibly give us an update of what your current blockers are to see if we can break them down and assist further. I know you mentioned the original problem was resolved once you used the proper Typescript import, but hopefully the documentation pages you listed above were able to assist you in implementing Data category and connecting the API. Beyond letting us know what you're still blocked by, wanted to make sure you had a few more resources that can help address general questions as well:
|
Hey @cwomack my question was clear above, I wanted to implement offline first app so what are the resources I should follow? |
Hey @cwomack I wanted to Implement Cognito Google Authentication with AWS Amplify in Mobile Apps Prerequisites: Describe the bug: I have installed the AWS CLI and configured AWS Amplify, as well as set up Google configuration. Upon using this hosted UI endpoint, I was able to see the Google login page. After entering the email and password, the user is successfully login. To achieve this, I added an intent filter in the AndroidManifest.xml file. Please let me know how to handle the redirect correctly. redirection still leads to the login page instead of the home page. Expected Behavior: after user login successfully redirect to home screen |
@Tructivity, there's a few ways to approach this. While DataStore is something that can be leveraged, we'd recommend doing something more along the lines of an "Offline AppSync" implementation that is described in better detail with issue #9481. Specfically, there's this comment in that issue. You can also leverage the GraphQL category within Amplify to use the subscription connection states and build logic for your users around those. Any type of offline scenario is going to require a bit of custom implementation and additional development work due to the complexities that comes with the offline experience. There's a feature request in our repo as well for improved offline support for session management in React Native apps captured in #10393 if you want to give that issue a comment/upvote for more traction. Let me know if all this is sufficient to help you make some progress! |
@cwomack Let me explain my situation, I have a web app developed using Dynamodb and GraphQL (AppSync) so I want to connect it to my React Native app. So first of all, I will use these two articles "Set up Amplify GraphQL API" and then move to "Create, update, and delete application data" to connect it to Dynamodb to get the data so I can do the CRUD operations on the mobile app but later also I want to add the offline sync. So which approach can be done from the two you've mentioned above? Also, is that possible? Because people are seeing a problem with that in the references you've mentioned. It seems your first suggestion Set up Amplify DataStore is better! See the video of my mobile app on my Google Drive for more info! |
@Tructivity if offline syncing capabilities are needed, then DataStore is currently the best way to do that and the corresponding docs you've linked are the best way to approach. To be clear, you should not use both the GraphQL API and DataStore at the same time. But outside of the offline syncing capabilities... interacting with AppSync directly via the GraphQL API category is going to be the preferred way to implement the CRUD operations that you're looking for. If you have any follow up questions while trying to build your app from here, feel free to join our Discord Server and we, or someone from the community, can help further. |
@cwomack thanks for the reply, but I've found the solution for this. I will first implement datastore for offline use, then do Syncing data to cloud which will do the rest of linking the offline data to the cloud since the cloud backend is already built. |
@cwomack please let me know if what I'm going to do after a few days is the right thing to do or not? |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
So we was linking the existing aws amplify back-end in the cloud which is the authentication part to the react native (Enable sign-up, sign-in, and sign-out, https://docs.amplify.aws/gen1/react-native/build-a-backend/auth/enable-sign-up/) and all the steps of the sign in and sign out has been done but the app then shows this error:
ERROR TypeError: Cannot read property 'configure' of undefined, js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
Expected behavior
When this error is fixed, then the app will run fine the authentication will work fine!
Reproduction steps
Apply the steps of the sign in and sign out of this article : Enable sign-up, sign-in, and sign-out (https://docs.amplify.aws/gen1/react-native/build-a-backend/auth/enable-sign-up/) and it will give you this error message:
ERROR TypeError: Cannot read property 'configure' of undefined, js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
Code Snippet
// Put your code below this line.
Log output
export default awsmobile;
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: