Closed Catazza closed 3 weeks ago
👋 Hi @Catazza, sorry you're having this issue. Just to confirm, when you say "production build", is it the production build from EAS? What command are you using?
👋 Hi @Catazza, sorry you're having this issue. Just to confirm, when you say "production build", is it the production build from EAS? What command are you using?
Hi @timngyn thanks for replying :) To be precise, it's in fact the preview the build with EAS that is without development client, which we push to App Store Connect or the Play store in order to do user testing. If I install directly the Android build (without passing from the Play Store) I still face the same issue.
I used the preview
profile in this eas.json:
{
"cli": {
"version": ">= 10.0.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"submit": {
"production": {}
}
}
}
@Catazza We don't directly support builds using EAS cloud services. To better isolate the issue, are you able to do a production build using Expo in your local development environment (outside of EAS)?
Another thing you could try to isolate the issue would be to remove the Authenticator and use the Amplify JS signIn function directly: https://docs.amplify.aws/react-native/build-a-backend/auth/connect-your-frontend/sign-in/
Hi @reesscot yes I also did try that, also local builds present the same issue. I can share some build logs if you wish? There's loads so I won't paste the whole block here!
And yes thanks for the suggestion, I am already onto trying the SignIn function - also because, I noticed in cloudtrail that the signIn event is responded with the challenge (for the SRP auth flow) and this is where it gets stuck. So I will also try with the "normal" password flow, which I can't seem to be able to configure in the authenticator component (although, signUp also presents the same issue, so in fact I doubt it's that).
Hi @Catazza, just to clarify to make sure I'm understanding correctly, when you say local builds, you're using the preview build from EAS right?
Have you also tried using this command npx expo run:ios --configuration Release
or npx expo run:android --variant release
? Taken from here: https://docs.expo.dev/more/expo-cli/#compiling-android
Hi @timngyn nice shout on trying the release variants from the CLI. I have done that (I used npx expo run:ios --configuration Release
), I still see the same error, but now I can see the logs in the console:
[RemoteTextInput] -[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation
requires a valid sessionID
@Catazza Can you also share your amplifyconfiguration.json file (with any sensitive pieces redacted)? It
Yes, any build logs you have would be helpful as well.
It also looks like you are overriding the loginMechanism and signUpAttributes. Do you get the same errors if you leave them off and let the configuration file determine your login type based on your Cognito settings?
Hi @timngyn @reesscot so to provide further details: I have also tried the "bare" signIn
function outside of the component, and we still get the same behaviour (i.e. it does work in the dev app version but not in the release one created with npx expo run:ios --configuration Release
). I have also enabled the plain USER_PASSWORD_AUTH auth flow, but that also does not work.
I might open an issue in the Amplify-js repo, as it's not just a UI component issue, also the bare amplify method does not work. WDYT?
Here's the auth part of the amplify_outputs.json by the way:
{
"auth": {
"user_pool_id": "xxxx",
"aws_region": "eu-central-1",
"user_pool_client_id": "xxxx",
"identity_pool_id": "xxxx",
"mfa_methods": [],
"standard_required_attributes": [
"email"
],
"username_attributes": [
"email"
],
"user_verification_types": [
"email"
],
"mfa_configuration": "OFF",
"password_policy": {
"min_length": 8,
"require_numbers": true,
"require_lowercase": true,
"require_uppercase": true,
"require_symbols": true
},
"unauthenticated_identities_enabled": true
}
}
Hey @Catazza, thanks so much for trying that out. That makes sense to open the issue in Amplify JS. I can transfer the issue over to their repo (so you don't have to open a new ticket)
@Catazza, thanks for opening this issue and we'll investigate this/attempt to reproduce on our side. In the mean time, are you seeing any errors or logs (either screenshots or text) that can be shared on the release build?
@Catazza, thanks for opening this issue and we'll investigate this/attempt to reproduce on our side. In the mean time, are you seeing any errors or logs (either screenshots or text) that can be shared on the release build?
Hi @cwomack I can't see anything beyond the screenshot I shared in the issue description. If I use the bare signIn method, I can't see anything at all (no logs no errors). I'll try setting up Sentry to see if I have any better luck there
@cwomack build logs when I run npx expo run:ios --configuration Release
don't say much:
› Planning build
› Executing react-native Pods/hermes-engine » [CP-User] [Hermes] Replace Hermes for the right configuration, if needed
› Executing react-native Pods/React-Fabric » [CP-User] [RN]Check rncore
› Executing expo-constants Pods/EXConstants » [CP-User] Generate app.config for prebuilt Constants.manifest
› Executing myapp » [Expo] Configure project
› Executing myapp » Bundle React Native code and images
Bundler cache is empty, rebuilding (this may take a minute)
› Executing myapp » [CP] Copy Pods Resources
› Signing myapp » myapp.app
› Build Succeeded
› 0 error(s), and 1 warning(s)
Starting Metro Bundler
Waiting on http://localhost:8081
› Installing on iPhone 15 Pro Max
› Opening on iPhone 15 Pro Max (com.myappai.myapp)
› Opening exp+myapp://expo-development-client/?url=http%3A%2F%2F192.168.1.42%3A8081 on iPhone 15 Pro Max
› Logs for your project will appear below.
[CoreFoundation] AddInstanceForFactory: No factory registered for id <CFUUID
xxxx> xxxxx
Cloudtrail event:
{
"eventVersion": "1.08",
"userIdentity": {
"type": "Unknown",
"principalId": "Anonymous"
},
"eventTime": "2024-07-12T19:21:42Z",
"eventSource": "cognito-idp.amazonaws.com",
"eventName": "InitiateAuth",
"awsRegion": "eu-central-1",
"sourceIPAddress": "1234",
"userAgent": "myapp/1 CFNetwork/1474 Darwin/22.6.0",
"requestParameters": {
"authFlow": "USER_PASSWORD_AUTH",
"authParameters": "HIDDEN_DUE_TO_SECURITY_REASONS",
"clientId": "xxxx"
},
"responseElements": {
"challengeParameters": "HIDDEN_DUE_TO_SECURITY_REASONS",
"authenticationResult": {
"accessToken": "HIDDEN_DUE_TO_SECURITY_REASONS",
"expiresIn": 3600,
"tokenType": "Bearer",
"refreshToken": "HIDDEN_DUE_TO_SECURITY_REASONS",
"idToken": "HIDDEN_DUE_TO_SECURITY_REASONS"
}
},
"additionalEventData": {
"sub": "xxxx"
},
"requestID": "e84e5394-62f0-47ab-88ee-ef2e4c548e0b",
"eventID": "7360e3c0-ec1e-4365-9589-b63994091ce2",
"readOnly": false,
"eventType": "AwsApiCall",
"managementEvent": true,
"recipientAccountId": "12345678",
"eventCategory": "Management",
"tlsDetails": {
"tlsVersion": "TLSv1.3",
"cipherSuite": "TLS_AES_128_GCM_SHA256",
"clientProvidedHostHeader": "cognito-idp.eu-central-1.amazonaws.com"
}
}
I am now going to investigate perhaps permission issues
Hi @Catazza Thank you for provide detailed information helping with the triaging process.
I created a minimum Expo app that invokes the Amplify signIn()
API without the Authenticator to isolate the issue. I created a production build use the Expo EAS build CLI and installed the app to an iPhone device. From testing I don't see any issues calling signIn()
, where I can sign in an end user, and subsequently get the user session via calling fetchAuthSession
.
From your screenshots in the original post, I saw "Network error" so I suspect the network request generated by signIn
or signUp
call didn't go through. Could you double check whether your native app has any network related configuration that's build scheme specific?
In your last comment though, the Cloudtrail log indicates that there was a successful sign in and tokens were returned to the client. Can you confirm whether this event was triggered by clicking the sign in button in your app?
I've encountered a similar issue. While the Expo dev client functions as expected, production build fail to render the children components as expected. The authenticator component allows sign up & sign in but after returning session information, the app content refuses to load. No visible faults when streaming log data in Console.
Hi @Catazza , wondering if you have had the chance to look into this request from Hui?
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.
We'll also reference the following docs that will hopefully help clear up what to do here if anyone else comes across this, which may be tied to how EAS is configured when using Expo CLI with React Native:
Thank you!
@Catazza wondering how you went with this? Running a new project with Amplify Gen 2 and thinking if using the Authenticator will be a time sink...
Before creating a new issue, please confirm:
On which framework/platform are you having an issue?
React Native
Which UI component?
Authenticator
How is your app built?
Expo Application Services
What browsers are you seeing the problem on?
iOS (React Native), Android (React Native)
Which region are you seeing the problem in?
No response
Please describe your bug.
The authenticator component work fine in iOS and Android simulators. It also works fine on real devices with expo development builds. However, it does not work when moving to production builds. This happens for both signin of already existing users, and sign up of new users:
The weird thing is that Cognito in the backed does receive the API calls. The user for example gets created, with uncorfirmed passwords.
I looked at AWS Cloudtrail events, and the API calls between the development builds and the production builds look identical.
What's the expected behaviour?
The component works identically between development and production builds.
Help us reproduce the bug!
Here is how we use the authenticator component in out
_layout.tsx
file:Here is the package.json:
Here is the screen with the actual login:
Code Snippet
Console log output
N/A it's a production build
Additional information and screenshots
No response