这个问题可能由于AWS Amplify CLI的默认行为引起。为了解决这个问题,您可以按照以下步骤在AWS Amplify项目中设置providerPlugin属性:
amplify configure
按照提示输入您的AWS凭证和配置。当控制台询问您要使用哪种AWS CLI配置文件时,选择默认的~/.aws/config选项。
接下来,使用以下命令为项目设置providerPlugin属性:
amplify update api
对于这个命令,控制台将提示您选择要更新的API。选择您想更新的API。然后,系统会显示配置选项。
在配置选项中,找到“选项: providerPlugin”的行。将它的值更改为“awscloudformation”。
? Please select from one of the below mentioned services: GraphQL, REST
? Select from the options below Api name
? Please provide a friendly name for your resource that will be used to label this category in the project: myapi
? Please provide a path (e.g., /items) /users
? Please choose the default authorization type for the API Amazon Cognito User Pool
Use a Cognito user pool configured as a part of this project
Create a new Cognito user pool
? Do you want to configure advanced settings? No, I am done.
? Do you want to configure Lambda Triggers for Cognito? No
? Do you want to edit the local lambda function now? No
? Select the authentication/authorization services that you want to use: User Pool configuration
? Do you want to enable conflict detection? No
? Do you want to enable lambda proxy integration for the GraphQL API Yes
? Allow Amazon Cognito authentication (slower) No
? Do you want to restrict API access Yes
? Who should have access? Authenticated users only
? What kind of access do you want for Authenticated users? CRUD