amplify function update -> Cannot destructure property 'serviceWalkthroughFilename' of 'serviceMetadata'
See original GitHub issueBefore opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
14
Amplify CLI Version
10.3.1
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
none
Amplify Categories
auth, analytics, notifications
Amplify Commands
update
Describe the bug
Since 10.3.1, when performing an amplify update, changing resource permissions will result in the following error: Rolling back to 10.0.0 fixes the issue
⚠️ Could not get policies for analytics: projectname
Policies cannot be added for analytics
TypeError: Cannot destructure property ‘serviceWalkthroughFilename’ of ‘serviceMetadata’ as it is undefined.
at Object.getPermissionPolicies (C:\snapshot\repo\build\node_modules\amplify-category-analytics\lib\provider-utils\awscloudformation\index.js:56:5)
at C:\snapshot\repo\build\node_modules\amplify-category-analytics\lib\index.js:112:32
at Array.forEach (<anonymous>)
at getPermissionPolicies (C:\snapshot\repo\build\node_modules\amplify-category-analytics\lib\index.js:102:35)
at AmplifyToolkit.invokePluginMethod [as _invokePluginMethod] (C:\snapshot\repo\build\node_modules@aws-amplify\cli-internal\lib\extensions\amplify-helpers\invoke-plugin-method.js:39:12)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async getResourcesForCfn (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\service-walkthroughs\execPermissionsWalkthrough.js:183:56)
at async askExecRolePermissionsQuestions (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\service-walkthroughs\execPermissionsWalkthrough.js:113:66)
at async Object.updateWalkthrough (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\service-walkthroughs\lambda-walkthrough.js:197:38)
at async updateFunctionResource (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\index.js:155:22)
at async Object.executeAmplifyCommand (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\index.js:267:5)
at async executePluginModuleCommand (C:\snapshot\repo\build\node_modules@aws-amplify\cli-internal\lib\execution-manager.js:142:5)
at async executeCommand (C:\snapshot\repo\build\node_modules@aws-amplify\cli-internal\lib\execution-manager.js:40:9)
at async Object.run (C:\snapshot\repo\build\node_modules@aws-amplify\cli-internal\lib\index.js:153:5)
Expected behavior
Able to update the resource permissions for a function
Reproduction steps
- add api, auth, analytics and notifications to project
- Add a lambda function
- Update resource permissions using amplify function update, to add permissions to the ‘analytics’ resource
GraphQL schema(s)
# Put schemas below this line
Project Identifier
3bd747f16af991e4d8595be2c88f28e0
Log output
# Put your logs below this line
⚠️ Could not get policies for analytics: projectname
Policies cannot be added for analytics
TypeError: Cannot destructure property 'serviceWalkthroughFilename' of 'serviceMetadata' as it is undefined.
at Object.getPermissionPolicies (C:\snapshot\repo\build\node_modules\amplify-category-analytics\lib\provider-utils\awscloudformation\index.js:56:5)
at C:\snapshot\repo\build\node_modules\amplify-category-analytics\lib\index.js:112:32
at Array.forEach (<anonymous>)
at getPermissionPolicies (C:\snapshot\repo\build\node_modules\amplify-category-analytics\lib\index.js:102:35)
at AmplifyToolkit.invokePluginMethod [as _invokePluginMethod] (C:\snapshot\repo\build\node_modules\@aws-amplify\cli-internal\lib\extensions\amplify-helpers\invoke-plugin-method.js:39:12)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async getResourcesForCfn (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\service-walkthroughs\execPermissionsWalkthrough.js:183:56)
at async askExecRolePermissionsQuestions (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\service-walkthroughs\execPermissionsWalkthrough.js:113:66)
at async Object.updateWalkthrough (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\service-walkthroughs\lambda-walkthrough.js:197:38)
at async updateFunctionResource (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\provider-utils\awscloudformation\index.js:155:22)
at async Object.executeAmplifyCommand (C:\snapshot\repo\build\node_modules\amplify-category-function\lib\index.js:267:5)
at async executePluginModuleCommand (C:\snapshot\repo\build\node_modules\@aws-amplify\cli-internal\lib\execution-manager.js:142:5)
at async executeCommand (C:\snapshot\repo\build\node_modules\@aws-amplify\cli-internal\lib\execution-manager.js:40:9)
at async Object.run (C:\snapshot\repo\build\node_modules\@aws-amplify\cli-internal\lib\index.js:153:5)
Additional information
rolling back to 10.0.0 fixes the issue
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Hey @conorw, thank you for reaching out. I was able to reproduce the issue with the following steps. CLI version 10.3.2
observed the following error.
Note: ran
amplify push
to check if the Lambda role updates with the policy but did not observe any additional permissions. running update function with resource access permissions shows analytics as not selected.Marking this as a bug. Thank you for reporting.
Reopening the issue. Thank you for reporting this, I was able to reproduce this issue. observed the following error when providing Lambda function access to user pool groups.
Note: tested when on testing in
11.0.0-beta.3