在amplify中,我添加了Api和a Auth (AWS Cognito)资源,如下所示。Api配置为使用Auth Cognito用户池进行身份验证。
┌──────────┬───────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼───────────────┼───────────┼───────────────────┤
│ Auth │ testd50c8ec7 │ No Change │ awscloudformation │
├──────────┼───────────────┼───────────┼───────────────────┤
│ Api │ testApi │ No Change │ awscloudformation │
└──────────┴───────────────┴───────────┴───────────────────┘我还在开发中,我想将Auth (Cognito)更改为使用电话号码登录。因此,我必须删除Auth并添加一个新的Auth资源(不允许通过电话登录更改现有用户池)。当我删除Auth资源并执行amplify push。我得到一个错误:
Template error: instance of Fn::GetAtt references undefined resource testd50c8ec7如何删除旧的认证资源并添加新的认证资源?
发布于 2021-09-17 06:56:34
我在这个问题上挣扎了很多天,所以我把这个答案打出来,以帮助我自己(和读者)在未来的几个小时里感到沮丧。
似乎一旦Api链接到Auth用户池配置,它总是需要可用的活动Auth Cognito用户池资源。因此,我需要按照以下步骤进行操作:
amplify remove authamplify add auth您可以根据自己的喜好基于this AWS doc修改./backend/auth/<new resource name>/parameters.json和backend/auth/<new resource name>/<new resource name>-cloudformation-template.yml
对Api资源执行
% amplify update api
? Please select from one of the below mentioned services: GraphQL
? Select from the options below Update auth settings
? Choose the default authorization type for the API Amazon Cognito User Pool
Use a Cognito user pool configured as a part of this project.
? Configure additional auth types? Yes
? Choose the additional authorization types you want to configure for the API API key
API key configuration
? Enter a description for the API key:
? After how many days from now the API key should expire (1-365): 7amplify status应该会显示如下内容:┌──────────┬─────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Auth │ test852bbeb0 │ Create │ awscloudformation │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Api │ testApi │ Update │ awscloudformation │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Auth │ testd50c8ec7 │ Delete │ awscloudformation │
└──────────┴─────────────────┴───────────┴───────────────────┘amplify push没有错误或困难。https://stackoverflow.com/questions/69219028
复制相似问题