docs
docs copied to clipboard
Gen 2 quickstart app throws error "The provided configuration is not a valid json"
Description
I have follow this gen2 quickstart to create an flutter app, but experiences two issues that make this not work:
- The doc's sample code to add auth is importing 'amplifyconfiguration.dart' but the actual file generated by sandbox is 'amplify_outputs.dart', also 'Amplify.configure(outputs)' should be
Amplify.configure(amplifyConfig) - After fix the fthe above, and run the app, it throws error "The provided configuration is not a valid json. Check underlyingException." for line "Amplify.configure(amplifyConfig)"
This happens when running the app in windows or Chrome.
Categories
- [ ] Analytics
- [ ] API (REST)
- [ ] API (GraphQL)
- [ ] Auth
- [ ] Authenticator
- [ ] DataStore
- [ ] Notifications (Push)
- [ ] Storage
Steps to Reproduce
Just follow the exact steps of the quick start: https://docs.amplify.aws/flutter/start/quickstart/ to create a flutter app
Screenshots
Platforms
- [ ] iOS
- [ ] Android
- [X] Web
- [ ] macOS
- [X] Windows
- [ ] Linux
Flutter Version
3.19.5
Amplify Flutter Version
1.8.0 or 1.0.0 (which is in the doc)
Deployment Method
Amplify CLI
Schema
amplify_outputs.dart
const amplifyConfig = '''{
"auth": {
"user_pool_id": "us-west-2_ChIP1YTjX",
"aws_region": "us-west-2",
"user_pool_client_id": "5r9ckh2si4fqtpqdfj4n58h87g",
"identity_pool_id": "us-west-2:8333ada3-dec3-4dac-80d5-0145f63b26ae",
"standard_required_attributes": [
"email"
],
"username_attributes": [
"email"
],
"user_verification_types": [
"email"
],
"password_policy": {
"min_length": 8,
"require_numbers": true,
"require_lowercase": true,
"require_uppercase": true,
"require_symbols": true
},
"unauthenticated_identities_enabled": true
},
"data": {
"url": "https://b6k6zcee3zcf7bwvoubrzwwtha.appsync-api.us-west-2.amazonaws.com/graphql",
"aws_region": "us-west-2",
"default_authorization_type": "AWS_IAM",
"authorization_types": [
"AMAZON_COGNITO_USER_POOLS"
],
"model_introspection": {
"version": 1,
"models": {
"Todo": {
"name": "Todo",
"fields": {
"id": {
"name": "id",
"isArray": false,
"type": "ID",
"isRequired": true,
"attributes": []
},
"content": {
"name": "content",
"isArray": false,
"type": "String",
"isRequired": false,
"attributes": []
},
"createdAt": {
"name": "createdAt",
"isArray": false,
"type": "AWSDateTime",
"isRequired": false,
"attributes": [],
"isReadOnly": true
},
"updatedAt": {
"name": "updatedAt",
"isArray": false,
"type": "AWSDateTime",
"isRequired": false,
"attributes": [],
"isReadOnly": true
}
},
"syncable": true,
"pluralName": "Todos",
"attributes": [
{
"type": "model",
"properties": {}
},
{
"type": "auth",
"properties": {
"rules": [
{
"allow": "public",
"provider": "iam",
"operations": [
"create",
"update",
"delete",
"read"
]
}
]
}
}
],
"primaryKeyInfo": {
"isCustomPrimaryKey": false,
"primaryKeyFieldName": "id",
"sortKeyFieldNames": []
}
}
},
"enums": {},
"nonModels": {}
}
},
"version": "1"
}''';
Hello @hangoocn - This appears to be a documentation issue. The command should include --config-version 0
npx ampx sandbox --outputs-format dart ----outputs-out-dir lib --config-version 0
Thanks @Jordan-Nelson , it is working when I add --outputs-version 0.