I am working on a React project using AWS Amplify Gen 1 and attempting to set up a GraphQL API. I have initialized my Amplify project and added a GraphQL API using the default To-do List schema. However, when trying to push the schema and generate the required code, I am encountering errors.
[adonys@DESKTOP-LO73D5J react-aws-amplify]$ amplify push
⠇ Fetching updates to backend environment: dev from the cloud.⠋ Building resource api/reactawsamplify
⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
⠸ Building resource api/reactawsamplify✅ GraphQL schema compiled successfully.
Edit your schema at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema.graphql or place .graphql files in a directory at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema
✔ Successfully pulled backend environment dev from the cloud.
⠋ Building resource api/reactawsamplify
⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
⠸ Building resource api/reactawsamplify✅ GraphQL schema compiled successfully.
Edit your schema at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema.graphql or place .graphql files in a directory at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema
Current Environment: dev
┌──────────┬─────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Api │ reactawsamplify │ Create │ awscloudformation │
└──────────┴─────────────────┴───────────┴───────────────────┘
✔ Are you sure you want to continue? (Y/n) · yes
⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
✅ GraphQL schema compiled successfully.
Edit your schema at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema.graphql or place .graphql files in a directory at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema
⠋ Building resource api/reactawsamplify
⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
⠹ Building resource api/reactawsamplify✅ GraphQL schema compiled successfully.
Edit your schema at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema.graphql or place .graphql files in a directory at /home/adonys/react-aws-amplify/amplify/backend/api/reactawsamplify/schema
? Do you want to generate code for your newly created GraphQL API Yes
? Choose the code generation language target typescript
? Enter the file name pattern of graphql queries, mutations and subscriptions src/graphql/**/*.ts
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions Yes
? Enter maximum statement depth [increase from default if your schema is deeply nested] 2
? Enter the file name for the generated code src/API.ts
Deployment completed.
Deploying root stack reactawsamplify [ ---------------------------------------- ] 0/2
amplify-reactawsamplify-dev-5… AWS::CloudFormation::Stack UPDATE_IN_PROGRESS Sun Nov 10 2024 20:36
apireactawsamplify AWS::CloudFormation::Stack CREATE_IN_PROGRESS Sun Nov 10 2024 20:36
Deployed api reactawsamplify [ ======================================== ] 6/6
GraphQLAPI AWS::AppSync::GraphQLApi CREATE_COMPLETE Sun Nov 10 2024 20:36
GraphQLAPIDefaultApiKey215A6D… AWS::AppSync::ApiKey CREATE_COMPLETE Sun Nov 10 2024 20:36
GraphQLAPITransformerSchema3C… AWS::AppSync::GraphQLSchema CREATE_COMPLETE Sun Nov 10 2024 20:37
GraphQLAPINONEDS95A13CF0 AWS::AppSync::DataSource CREATE_COMPLETE Sun Nov 10 2024 20:36
Todo AWS::CloudFormation::Stack CREATE_COMPLETE Sun Nov 10 2024 20:37
CustomResourcesjson AWS::CloudFormation::Stack CREATE_COMPLETE Sun Nov 10 2024 20:37
Code generation failed with the following error
Invalid or incomplete schema, unknown type: AWSModelQueryMap. Ensure that a full introspection query is used in order to build a client schema..
Deployment state saved successfully.
Additional Context:
I'm unsure why this error related to AWSModelQueryMap
is occurring, especially since I'm using the default schema provided by Amplify. Could it be related to outdated configurations, or is there something else I'm missing?
Any insights or suggestions on how to resolve this issue would be greatly appreciated!
We encounter the same problem on front end as well regarding this AWSModelQueryMap type issue.
We updated the amplify pckg to the latest one which was released 3 days ago ( 6.8.3 ) and it solved the problem.