在将策略分配给AWS函数以供用户组访问时出错

问题描述

我具有预注册功能,可以将用户添加用户组。我通过CLI添加策略以授权功能新用户池组,但是,出现以下错误

> Could not get policies for auth: userPoolGroups Policies cannot be
> added for auth TypeError: Cannot destructure property
> `serviceWalkthroughFilename` of 'undefined' or 'null'.
>     at Object.getPermissionPolicies (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/lib/provider-utils/awscloudformation/index.js:248:61)
>     at Object.keys.forEach.resourceName (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/lib/index.js:231:67)
>     at Array.forEach (<anonymous>)
>     at getPermissionPolicies (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/lib/index.js:226:37)
>     at Object.exports.askExecRolePermissionsQuestions (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/execPermissionsWalkthrough.js:144:78)
>     at process._tickCallback (internal/process/next_tick.js:68:7)

https://github.com/aws-amplify/amplify-cli/issues/165 在这里,我发现放大功能尚未实现,他们建议添加策略以授权功能调用auth。 在这种情况下,我正在关注:

? Select which capability you want to update: Lambda function (serverless function)
? Select the Lambda function you want to update funcPreSignup
? Do you want to update the Lambda function permissions to access other resources in this project? Yes
? Select the category auth
? Auth has 2 resources in this project. Select the one you would like your Lambda to access projauth
? Select the operations you want to permit for projauth create,read,update,delete

You can access the following resource attributes as environment variables from your Lambda function
        AUTH_PROJ_USERPOOLID
? Do you want to invoke this function on a recurring schedule? No
? Do you want to configure Lambda layers for this function? No
Error: Cannot add funcPreSignup due to a cyclic dependency
    at checkForCyclicDependencies (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/update-amplify-Meta.js:188:15)
    at AmplifyToolkit.updateamplifyMetaAfterResourceUpdate [as _updateamplifyMetaAfterResourceUpdate] (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/update-amplify-Meta.js:114:9)
    at updateFunctionResource (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/index.js:144:29)
    at process._tickCallback (internal/process/next_tick.js:68:7)
There was an error adding the function resource

即使我看到它修改了CloudFormation堆栈,它仍然会继续错误显示授权异常

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)