Closed saltedpotatos closed 1 year ago
Hi @saltedpotatos - have you followed the platform setup steps for macOS here?
Yep! The podfile, deployment target, and minimum deployment are all 10.15, network calls are allowed, and keychain sharing setup.
Okay thanks. Are you seeing this in development mode?
Correct, this has all been in debug mode.
I wasn't able to reproduce this. I created an amplify app with a refresh token expiry of 60 minutes. I ran it on macOS, logged in, stopped the debug session, waited 60 minutes, debugged the app again, and logged in.
What version of macOS are you using? What chip type (apple silicon or intel)? What version of Xcode are you using?
My version of OSX is Ventura, 13.4.1(c) running on Intel. Xcode is Version 14.3.1 (14E300c)
I have another project with the same front end Authenticator setup, although a different amplify config, and a working session that I just signed out of, and now hit the same crash on hitting the sign in button.
I've re-generated the keychain sharing in the project, as well as tried changing the storageFactory to a non data protected one to no change as well.
Hi @saltedpotatos are you able to provide the full crash report?
Yep here's a gist of the most recent one
Thank you. Since the Flutter UI thread is crashing, I'm wondering if this an issue in Flutter itself. There are some reports in the Flutter repo for this (https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+EXC_BAD_ACCESS).
I don't have an Intel Mac computer to test on, but I will think about how we can try and reproduce this. Thanks for your patience.
@saltedpotatos Can you try on Flutter 3.10 (previous stable release) and Flutter beta channel to see if that resolves the issue? You can use fvm to make it easy to test multiple versions.
Assuming I'm using fvm correctly, no changes had any affect.
fvm use beta
fvm flutter run -d macos
fvm use 3.10.6
fvm flutter run -d macos
Both still crash with EXC_BAD_ACCESS when hitting the sign in button
Okay, thank you so much for trying.
@saltedpotatos Can you try running your app with an in memory version of secure storage? I am hoping to see if this is related to how we store/fetch credentials on the device.
Here is how you can do that:
// define a class for in memory storage
class InMemoryStorage implements SecureStorageInterface {
InMemoryStorage(this.scope);
/// The scope of the item being stored.
///
/// This can be used as a namespace for stored items.
final AmplifySecureStorageScope scope;
static final Map<String, String> _data = {};
@override
void write({required String key, required String value}) {
_data['${scope.name}.$key'] = value;
}
@override
String? read({required String key}) {
return _data['${scope.name}.$key'];
}
@override
void delete({required String key}) {
_data.remove('${scope.name}.$key');
}
}
// use that class when configuring the plugin
await Amplify.addPlugin(
AmplifyAuthCognito(secureStorageFactory: InMemoryStorage.new),
);
Hi @Jordan-Nelson ,
I've attempted it with the class you've provided to no change.
Crashed Thread: 3 io.flutter.ui
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at [....]
That was the initial line of thinking I had tried as well, when I tried to use a nonDataProtected storage factory.
I didn't dig too deeply into the source, but since it crashes before validating that my sign in information is valid, I'm assuming it doesn't make it to the SecureStorage.
Oh I see. You mean that even if the basic password reqs (min length, letters/numbers, etc.) are not met, it still crashes? You are correct - that validation is performed before anything is read from storage.
Can you enable verbose logging and share the logs to try to help us identify exactly at what point the crash happens? Please note that there could be sensitive data in verbose logs. Feel free to redact data if needed. Alternatively you can share it in a private gist.
You can enable verbose logging like so:
void main() {
// add this like anywhere before calling configure()
AmplifyLogger().logLevel = LogLevel.verbose;
runApp(MyApp());
}
Correct. As far as input goes.
If I hit submit with an empty email / password field, I get validation errors that fields cannot be blank.
If I submit anything that is formatted like an email, and a non empty password input, that will crash. Even if those inputs do not meet the passwordPolicyMinLength set in my amplifyConfig.
Here is the logs. I'm unsure what the privateA/publicA are, but I can include those if necessary.
A Dart VM Service on macOS is available at: http://127.0.0.1:59111/OWpzb2SsTVE=/
flutter: INFO: 2023-08-29 12:57:52.975611: setting initial location /
flutter: DEBUG | StateMachineBloc | Transforming event: Instance of 'AuthLoad'
flutter: FINE: 2023-08-29 12:57:53.272281: Transforming event: Instance of 'AuthLoad'
flutter: DEBUG | StateMachineBloc | Emitting next state: Instance of LoadingState
flutter: FINE: 2023-08-29 12:57:53.276359: Emitting next state: Instance of LoadingState
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:59111/OWpzb2SsTVE=/
flutter: Bout to open the db
flutter: Amplify is configured
flutter: DEBUG | StateMachineBloc | Emitting next state: UnauthenticatedState [AuthenticatorStep.signIn]
flutter: FINE: 2023-08-29 12:57:53.938108: Emitting next state: UnauthenticatedState [AuthenticatorStep.signIn]
flutter: DEBUG | StateMachineBloc | Transforming event: Instance of 'AuthSignIn'
flutter: FINE: 2023-08-29 12:58:56.253410: Transforming event: Instance of 'AuthSignIn'
flutter: DEBUG | SignInStateMachine | Device secrets not present for user: email@emai.l
flutter: FINE: 2023-08-29 12:58:56.293146: Device secrets not present for user: email@emai.l
flutter: DEBUG | SrpInitWorker | Starting worker
flutter: FINE: 2023-08-29 12:58:56.298807: Starting worker
flutter: DEBUG | SrpInitWorker | Connected from worker
flutter: FINE: 2023-08-29 12:58:56.310043: Connected from worker
flutter: VERBOSE | SrpInitWorker | Got message: SrpInitResult {
privateA=[...]
publicA=[...],
}
flutter: FINEST: 2023-08-29 12:58:56.363082: Got message: SrpInitResult {
flutter: privateA=[...],
flutter: publicA=[...],
flutter: }
Lost connection to device.
Thank you @saltedpotatos. Would you be able to upgrade to v1.4.0 and capture the logs again? I had added more verbose logs in these code paths.
Thanks for your patience working through this.
No worries! Thanks to y'all as well. Non reproducible issues are a blast!
New dependencies:
- amplify_authenticator 1.4.0
- amplify_auth_cognito >=1.4.0 <1.5.0
- amplify_core >=1.4.0 <1.5.0
- amplify_flutter >=1.4.0 <1.5.0
- amplify_authenticator ^1.1.1
- amplify_auth_cognito ^1.4.0
- amplify_flutter ^1.4.0
- amplify_flutter ^1.4.0
- amplify_auth_cognito ^1.4.0
- amplify_auth_cognito ^1.4.0
- amplify_flutter ^1.4.0
- amplify_authenticator ^1.1.1
- amplify_analytics_pinpoint 1.4.0
- amplify_analytics_pinpoint_dart >=0.3.0+5 <0.4.0
- amplify_core >=1.4.0 <1.5.0
- amplify_db_common >=0.3.0+5 <0.4.0
- amplify_secure_storage >=0.4.0+5 <0.5.0
- amplify_analytics_pinpoint_dart 0.3.0+7
- amplify_core >=1.4.0 <1.5.0
- amplify_db_common_dart >=0.3.0+5 <0.4.0
- amplify_secure_storage_dart >=0.4.0+5 <0.5.0
- amplify_auth_cognito 1.4.0
- amplify_analytics_pinpoint >=1.4.0 <1.5.0
- amplify_analytics_pinpoint_dart >=0.3.0+5 <0.4.0
- amplify_auth_cognito_dart >=0.10.3 <0.11.0
- amplify_core >=1.4.0 <1.5.0
- amplify_flutter >=1.4.0 <1.5.0
- amplify_secure_storage >=0.4.0+5 <0.5.0
- amplify_auth_cognito_dart 0.10.3
- amplify_analytics_pinpoint_dart >=0.3.0+5 <0.4.0
- amplify_core >=1.4.0 <1.5.0
- amplify_secure_storage_dart >=0.4.0+6 <0.5.0
- amplify_core 1.4.0
- amplify_db_common 0.3.0+6
- amplify_db_common_dart >=0.3.0+5 <0.4.0
- amplify_db_common_dart 0.3.1
- amplify_core >=1.4.0 <1.5.0
- amplify_flutter 1.4.0
- amplify_core >=1.4.0 <1.5.0
- amplify_secure_storage >=0.4.0+5 <0.5.0
- amplify_secure_storage 0.4.0+5
- amplify_secure_storage_dart >=0.4.0+5 <0.5.0
- amplify_secure_storage_dart 0.4.0+6
Logs:
Hi @saltedpotatos, I found a bug in our FFI code which may be causing this issue. Would you be willing to give the fix a whirl and let me know if it helps?
dependency_overrides:
amplify_auth_cognito_dart:
git:
url: https://github.com/aws-amplify/amplify-flutter
ref: fix/auth/bad-access-crash
path: packages/auth/amplify_auth_cognito_dart
amplify_core:
git:
url: https://github.com/aws-amplify/amplify-flutter
ref: fix/auth/bad-access-crash
path: packages/amplify_core
Thanks again!
No change, unfortunately.
Although, I could have sworn flutter used to post a warning when you were using depency_overrides. Maybe I'm misremembering though.
I also didn't see any log printouts that I recognized from your fix branch, which has me second guessing myself.
Thanks for trying. The log messages should be visible by setting AWSLogger().logLevel = LogLevel.verbose
in your main function.
Hi @saltedpotatos, I was able to reproduce this by running under Rosetta (should've thought of this sooner!) I believe it's due to a bug in package:ffigen
, which I've opened an issue for here.
In the meantime, I've commented out the offending code. Would you be willing to run flutter pub upgrade
and see if the issue is resolved for you? Thanks!
Thanks @dnys1!
I can confirm the changes solved the issue for me.
Thanks for confirming and thanks for your help. I'll work to get this released by early next week.
The fix for this has been released. Please run flutter pub upgrade
to get the fix.
Apologies for the delay! Let us know if you face any similar issues.
Description
On launch on MacOS, I was signed out with a session expired notification. On any attempt to sign in, the app crashes to desktop. This crash occurs before password validation, any valid input will crash. Unfortunately, I'm not sure where to go from here with regards to troubleshooting.
On iOS, everything functions as expected.
Dependencies:
dart pub deps --style list --no-dev | grep amplify
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Flutter Version
3.13.1
Amplify Flutter Version
1.3.2
Deployment Method
Custom Pipeline
Schema
No response