Skip to content
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

Amplify Configure passwordPolicyMinLength expected int but is string #9655

Closed
jody-schering opened this issue Jan 30, 2022 · 5 comments
Closed

Comments

@jody-schering
Copy link

Describe the bug
On 0.3.2 when calling Amplify.configure() passing in the generated amplify configuration and with the auth plugin added I get the following exception:

flutter: type 'String' is not a subtype of type 'int?' in type cast
flutter: #0 _$PasswordProtectionSettingsFromJson
package:amplify_flutter/…/cognito/password_protection_settings.g.dart:27
aws-amplify/amplify-flutter#1 new PasswordProtectionSettings.fromJson
package:amplify_flutter/…/cognito/password_protection_settings.dart:39
aws-amplify/amplify-flutter#2 _$CognitoAuthConfigFromJson
package:amplify_flutter/…/cognito/auth.g.dart:45
aws-amplify/amplify-flutter#3 new CognitoAuthConfig.fromJson
package:amplify_flutter/…/cognito/auth.dart:76
aws-amplify/amplify-flutter#4 _$CognitoPluginConfigFromJson.
package:amplify_flutter/…/auth/cognito_config.g.dart:49
aws-amplify/amplify-flutter#5 _$AWSConfigMapFromJson.
package:amplify_flutter/…/config/config_map.g.dart:30
aws-amplify/amplify-flutter#6 MapMixin.map (dart:collection/maps.dart:170:28)
aws-amplify/amplify-flutter#7 _$AWSConfigMapFromJson
package:amplify_flutter/…/config/config_map.g.dart:29
aws-amplify/amplify-flutter#8 new AWSConfigMap.fromJson
package:amplify_flutter/…/config/config_map.dart:82
aws-amplify/amplify-flutter#9 _$CognitoPluginConfigFromJson <…>

amplify creates the config with auth password protection settings passwordPolicyMinLength as a string, but from the error above it is expecting it to be an int?. Manually changing passwordPolicyMinLength to an int fixes the error. However since its generated it always gets overridden.

"passwordProtectionSettings": {
"passwordPolicyMinLength": "10",
"passwordPolicyCharacters": [
"REQUIRES_LOWERCASE",
"REQUIRES_UPPERCASE",
"REQUIRES_NUMBERS",
"REQUIRES_SYMBOLS"
]
},

To Reproduce
Steps to reproduce the behavior:

  1. Create an amplify project using 0.3.2 version of amplify.
  2. Add auth using the cli and set the password length to 10
  3. Add the auth plugin and call amplify configure from the main.dart
  4. See the error above.

Expected behavior
Amplify.configure does not throw a cast exception.

Screenshots
N/A
Platform
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
[] Android
[x] iOS

Output of

  • Flutter version 2.8.1 at /Users/jody/flutter
  • Upstream repository https://github.com/flutter/flutter.git
  • Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
  • Engine revision 890a5fca2e
  • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
  • Android SDK at /Users/jody/Library/Android/sdk
  • Platform android-32, build-tools 32.0.0
  • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
  • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
  • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
  • Xcode at /Applications/Xcode.app/Contents/Developer
  • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
  • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
  • Android Studio at /Applications/Android Studio.app/Contents
  • Flutter plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/9212-flutter
  • Dart plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/6351-dart
  • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.63.2)
  • VS Code at /Applications/Visual Studio Code.app/Contents
  • Flutter extension version 3.32.0

[✓] Connected device (1 available)
  • iPhone 13 (mobile) • 316D7D46-0A6F-4010-ADAD-08ABDC401F68 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)```

</details>

<details>

<summary>Dependencies (<code>pubspec.lock</code>)</summary>

Generated by pub

See https://dart.dev/tools/pub/glossary#lockfile

packages:
amplify_analytics_pinpoint:
dependency: "direct main"
description:
name: amplify_analytics_pinpoint
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_analytics_plugin_interface:
dependency: transitive
description:
name: amplify_analytics_plugin_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_api:
dependency: "direct main"
description:
name: amplify_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_api_plugin_interface:
dependency: transitive
description:
name: amplify_api_plugin_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_auth_cognito:
dependency: "direct main"
description:
name: amplify_auth_cognito
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_auth_plugin_interface:
dependency: transitive
description:
name: amplify_auth_plugin_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_core:
dependency: "direct main"
description:
name: amplify_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_datastore:
dependency: "direct main"
description:
name: amplify_datastore
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_datastore_plugin_interface:
dependency: transitive
description:
name: amplify_datastore_plugin_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_flutter:
dependency: "direct main"
description:
name: amplify_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
amplify_storage_plugin_interface:
dependency: transitive
description:
name: amplify_storage_plugin_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
another_flushbar:
dependency: transitive
description:
name: another_flushbar
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.28"
another_transformer_page_view:
dependency: transitive
description:
name: another_transformer_page_view
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
bloc:
dependency: transitive
description:
name: bloc
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
date_time_format:
dependency: transitive
description:
name: date_time_format
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
equatable:
dependency: "direct main"
description:
name: equatable
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_bloc:
dependency: "direct main"
description:
name: flutter_bloc
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.1"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_login:
dependency: "direct main"
description:
name: flutter_login
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
flutter_signin_button:
dependency: transitive
description:
name: flutter_signin_button
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
font_awesome_flutter:
dependency: transitive
description:
name: font_awesome_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "9.2.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.4"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.4+4"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.1"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1+1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
url_launcher:
dependency: transitive
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.13"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.13"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.5"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
sdks:
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.5.0"


</details>

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
N/A
@fjnoyp
Copy link

fjnoyp commented Jan 30, 2022

Hi @jody-schering thank you for bringing this issue to our attention. This appears to be an issue with Amplify-cli setting the "passwordPolicyMinLength" field to a string instead of an int. Let's move your issue to their repo and ask them to help out.

Current:

"passwordProtectionSettings": {
"passwordPolicyMinLength": "10",

Expected:

"passwordProtectionSettings": {
"passwordPolicyMinLength": 10, 

@fjnoyp fjnoyp transferred this issue from aws-amplify/amplify-flutter Jan 30, 2022
@fjnoyp
Copy link

fjnoyp commented Jan 30, 2022

Please note, it seems amplify-cli used to generate just the integer with no quotes (based on the older amplifyconfiguration.json files we have in our repo) so having Amplify-flutter change to accept quotes could break existing user configurations.

@dnys1
Copy link
Contributor

dnys1 commented Jan 31, 2022

I've opened a PR with a fix.

@jody-schering - can you share which version of the CLI you're using so I can add a test case?

@jody-schering
Copy link
Author

I'm currently using 7.6.13

@cjihrig
Copy link
Contributor

cjihrig commented Feb 1, 2022

It appears that this issue is resolved by aws-amplify/amplify-flutter#1323, so I'm going to close this. Please let me know if additional action is required.

@cjihrig cjihrig closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants