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

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

Open
2 of 14 tasks
hangoocn opened this issue May 6, 2024 · 2 comments
Open
2 of 14 tasks
Labels
transferred This issue was transferred from another Amplify project

Comments

@hangoocn
Copy link

hangoocn commented May 6, 2024

Description

I have follow this gen2 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

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • 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"
}''';
@hangoocn hangoocn changed the title Follow Gen 2 quickstart, and it throws error "The provided configuration is not a valid json" Gen 2 quickstart throws error "The provided configuration is not a valid json" May 6, 2024
@hangoocn hangoocn changed the title Gen 2 quickstart throws error "The provided configuration is not a valid json" Gen 2 quickstart app throws error "The provided configuration is not a valid json" May 6, 2024
@Jordan-Nelson
Copy link
Contributor

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

@Jordan-Nelson Jordan-Nelson transferred this issue from aws-amplify/amplify-flutter May 6, 2024
@Jordan-Nelson Jordan-Nelson added the transferred This issue was transferred from another Amplify project label May 6, 2024
@hangoocn
Copy link
Author

hangoocn commented May 6, 2024

Thanks @Jordan-Nelson , it is working when I add --outputs-version 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transferred This issue was transferred from another Amplify project
Projects
None yet
Development

No branches or pull requests

2 participants