Have you ever created a sample AWS Amplify application and wanted to extend the DynamoDB database schema ? This post explains how to add a single owner parameter to the schema definition and any pitfalls that you may experience
AWS Amplify
AWS Amplify provides the authentication, Graph API, serverless and CI/CD capabilities in an easy to use format. This post assumes knowledge of these AWS services and that you have created a sample react notes app from the example here
Adding Owner Column
To add the owner column to the model, update the amplify/backend/api/reactamplified/schema.graphql file as follows
and add the following authentication informationExecute an amplify push command and ensure that the API is deployed successfully
Fix Cognito User Pool Error
If you receive the following error:
@auth directive with 'userPools' provider found, but the project has no Cognito User Pools authentication provider configured.
Execute the command amplify update api and update the auth settings, ensuring that you select "Amazon Cognito User Pool" as the default authorization type for the API
Check the Database
Perform a new insert operation and confirm that the DynamoDB table now has the owner column
Comments
Post a Comment