aws-amplify / aws-amplify/docs

Gen 2 quickstart app throws error "The provided configuration is not a valid json"

Open
#7,495 2 comments 0 reactions 0 assignees View on GitHub
transferred
Dominant language
MDX
Stars
506
Forks
1.1k
Avg merge
3h 14m
Merged PRs (30d)
1

Description

### Description

I have follow this gen2 [quickstart ](https://docs.amplify.aws/flutter/start/quickstart/) to create an flutter app, but experiences two issues that make this not work:

1. 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)`
2. 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

![image](https://github.com/aws-amplify/amplify-flutter/assets/14363128/26416f79-48c1-4b1c-8913-108d021a218c)

### 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

```GraphQL
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"
}''';
```
```

Contributor guide

Open the contributing guide

Research direction

Start with the Flutter quickstart linked in the issue and compare its documented imports and Amplify.configure example with the generated amplify_outputs.dart content. Reproduce the setup on Web or Windows using the listed Flutter and Amplify versions; done means the quickstart's generated configuration is accepted without the invalid JSON error.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.