Open armenr opened 10 months ago
Was feeling a bit spicy, so I pushed Co-Pilot just a bit further. Here's what it produced (as an exmaple/sample).
It is worth noting that even in this case, it doesn't appear to fully cover or specify everything that's documented in categories and sub-configurations here: https://docs.amplify.aws/vue/tools/libraries/configure-categories/
aws_project_region
: The AWS region where your project is located.aws_appsync_apiKey
: The API key for your AppSync API.aws_appsync_authenticationType
: The authentication type for your AppSync API (e.g., "API_KEY", "AWS_IAM", "OPENID_CONNECT", "AMAZON_COGNITO_USER_POOLS").aws_appsync_graphqlEndpoint
: The endpoint for your AppSync GraphQL API.aws_appsync_region
: The AWS region where your AppSync API is located.aws_bots_config
: An array of bot configurations.aws_cognito_identity_pool_id
: The ID of your Amazon Cognito identity pool.aws_cognito_region
: The AWS region where your Amazon Cognito service is located.aws_user_pools_id
: The ID of your Amazon Cognito user pool.aws_user_pools_web_client_id
: The web client ID for your Amazon Cognito user pool.aws_cognito_sign_up_verification_method
: The method used to verify sign-ups (e.g., "EMAIL", "PHONE_NUMBER").aws_cognito_mfa_configuration
: The multi-factor authentication (MFA) configuration (e.g., "OFF", "ON", "OPTIONAL").aws_cognito_mfa_types
: An array of MFA types (e.g., "SMS", "SOFTWARE_TOKEN").aws_cognito_password_protection_settings
: An object that specifies the password policy.
passwordPolicyMinLength
: The minimum length for passwords.passwordPolicyCharacters
: An array of character types that must be included in passwords (e.g., "UPPERCASE", "LOWERCASE", "NUMBERS", "SPECIAL_CHARACTERS").aws_cognito_verification_mechanisms
: An array of verification mechanisms (e.g., "EMAIL", "PHONE_NUMBER").aws_cognito_signup_attributes
: An array of attributes to collect from users when they sign up (e.g., "EMAIL", "PHONE_NUMBER").aws_cognito_social_providers
: An array of social identity providers to use for sign-in (e.g., "FACEBOOK", "GOOGLE", "LOGIN_WITH_AMAZON").aws_cognito_username_attributes
: An array of attributes to use as the username for users (e.g., "EMAIL", "PHONE_NUMBER").aws_mandatory_sign_in
: Whether sign-in is mandatory ("ENABLED" or "DISABLED").aws_mobile_analytics_app_id
: The app ID for your Amazon Mobile Analytics app.aws_mobile_analytics_app_region
: The AWS region where your Amazon Mobile Analytics app is located.aws_user_files_s3_bucket
: The name of your Amazon S3 bucket for user files.aws_user_files_s3_bucket_region
: The AWS region where your Amazon S3 bucket for user files is located.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing
: Whether to connect to the HTTP endpoint of your Amazon S3 bucket for testing (true or false).geo
: An object that specifies the Geo configuration.
amazon_location_service
: An object that specifies the Amazon Location Service configuration.search_indices
: An array of search indices.region
: The AWS region where your Amazon Location Service is located.oauth
: An object that specifies the OAuth configuration.
domain
: The domain for your OAuth endpoint.scope
: An array of scopes for your OAuth endpoint.redirectSignIn
: The redirect URL for sign-in.redirectSignOut
: The redirect URL for sign-out.responseType
: The response type for your OAuth endpoint (e.g., "CODE", "TOKEN").predictions
: An object that specifies the Predictions configuration.
convert
: An object that specifies the Convert configuration.speechGenerator
: An object that specifies the Speech Generator configuration.
defaults
: An object that specifies the default configuration.VoiceId
: The ID of the voice to use for speech generation.aws_cloud_logic_custom
: An array of custom Cloud Logic configurations. Each configuration is an object that includes:
name
: The name of the custom Cloud Logic configuration.endpoint
: The endpoint for the custom Cloud Logic configuration.region
: The AWS region where the custom Cloud Logic configuration is located.service
: The service for the custom Cloud Logic configuration.Notifications
: An object that specifies the Notifications configuration.
InAppMessaging
: An object that specifies the In-App Messaging configuration.
configuration.AWSPinpoint
: An object that specifies the AWS Pinpoint configuration.
appId
: The app ID for your AWS Pinpoint app.region
: The AWS region where your AWS Pinpoint app is located.Push
: An object that specifies the Push configuration.AWSPinpoint
: An object that specifies the AWS Pinpoint configuration.
appId
: The app ID for your AWS Pinpoint app.region
: The AWS region where your AWS Pinpoint app is located.modelIntrospection
: Whether model introspection is enabled (true or false). This is used for GraphQL Transform to generate additional metadata for your models.Hi @armenr thanks for opening this issue. In the case where you are not relying on the auto generated amplifyconfiguration.json
file, I'd recommend following the format for config depending on the category you need (Auth, API etc) and defined in the link you shared here - https://docs.amplify.aws/vue/tools/libraries/configure-categories/
Curious to understand what limitations you are facing with this approach?
Hey @nadetastic ! Thanks for diving into the issue with me, and for the prompt attention. :)
In terms of DX and productivity, our feeling is that it would be way more productive if we could just write out (to file) the CDK outputs to match the expected schema of the amplifyconfiguration.json
file (and even "mock" or "impersonate" that file with our own CDK outputs) would be way more productive than writing out a file, and then doing something like π this, where we have to cherry-pick them one by one.
import cdkOutputs from '../outputs.json'
Amplify.configure({
aws_appsync_graphqlEndpoint: cdkOutputs.BackendStack.AppSyncAPIURL,
aws_appsync_region: cdkOutputs.BackendStack.awsAppsyncRegion,
aws_appsync_authenticationType: cdkOutputs.BackendStack.AppSyncAuthType,
aws_appsync_apiKey: cdkOutputs.BackendStack.AppSyncAPIKey,
})
That would be the use-case for the ask. Just saving the time of pulling these in and mapping them, one-by-one. If the ask is a bit of a stretch, or it's antithetical to the intended DX of Amplify, I'm happy to withdraw my request π
Describe the content issue: As a user, I'd like to know where I can find the
amplifyconfiguration.json
schema. In other words, it would be very helpful to know all of the possible key/value (and nested key/value) pairs that this file exposes to the Amplify.configure({}) function, by default.After some digging: I was able to find this: https://github.com/aws-amplify/amplify-js/blob/a6a413caeec3570800168b8cc7cf976d7d765706/packages/core/src/parseAWSExports.ts#L33
It would appear this is where the magic happens, but this is a whole heck of a lot for a developer to go through, just to know what the config schema is for defining the config that the amplify library expects to consume, by default.
The existing documentation makes it impossible to infer the shape or schema of the JSON configuration file: https://docs.amplify.aws/vue/tools/libraries/configure-categories/
Use case
As an AWS Amplify user, I'd like to use CDK in place of the
amplify cli
-generated categories. I'd like to export and write my CDK outputs in an identical format to theamplifyconfiguration.json
schema, so that configuration of my Amplify libraries is seamless/transparent to Amplify. Stated differently, I could just callAmplify.configure()
without needing to manually configure each of the subcategories by pulling their values out of a custome-generated CDK output json file.URL page where content issue is: Uncertain which page it would belong in.
Other Notes
GitHub Co-Pilot and I had a nice chat about this. See screenshot π
I told it to consume
amplify-js/packages/core/src/parseAWSExports.ts
and reverse-engineer the JSON schema for the config file.This is what I got back: