aws-amplify / aws-amplify/amplify-cli
PluginNotFound Error when trying to add custom resources to a lambda function using amplify cli
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
npm
### If applicable, what version of Node.js are you using?
v16.13.2
### Amplify CLI Version
10.5.2
### What operating system are you using?
Mac
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
NA
### Describe the bug
When I use the cli commands 'amplify add function' or 'amplify update function' and select 'resource access permissions' and then select 'custom' I get the following error:
Policies cannot be added for custom
PluginMethodNotFoundError: Method getPermissionPolicies does not exist or is not a function in category plugin: custom.
at AmplifyToolkit.invokePluginMethod [as _invokePluginMethod] (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/invoke-plugin-method.js:35:15)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async getResourcesForCfn (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/execPermissionsWalkthrough.js:183:56)
at async askExecRolePermissionsQuestions (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/execPermissionsWalkthrough.js:113:66)
at async Object.updateWalkthrough (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/lambda-walkthrough.js:197:38)
at async updateFunctionResource (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/index.js:155:22)
at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/amplify-category-function/lib/index.js:267:5)
at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:142:5)
at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:40:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:153:5)
### Expected behavior
I would expect that there would be no error and that the file 'backend-config.json' would be auto-populated with the necessary custom resources in the 'dependsOn' for the function in question.
### Reproduction steps
******************************** % amplify add function
? Select which capability you want to add: Lambda function (serverless function)
? Provide an AWS Lambda function name: test
? Choose the runtime that you want to use: Python
Only one template found - using Hello World by default.
Available advanced settings:
- Resource access permissions
- Scheduled recurring invocation
- Lambda layers configuration
- Environment variables configuration
- Secret values configuration
? Do you want to configure advanced settings? Yes
? Do you want to access other resources in this project from your Lambda function? Yes
? Select the categories you want this function to have access to. custom
? Select the operations you want to permit on [_custom resource_] read
Policies cannot be added for custom
PluginMethodNotFoundError: Method getPermissionPolicies does not exist or is not a function in category plugin: custom.
at AmplifyToolkit.invokePluginMethod [as _invokePluginMethod] (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/invoke-plugin-method.js:35:15)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async getResourcesForCfn (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/execPermissionsWalkthrough.js:183:56)
at async askExecRolePermissionsQuestions (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/execPermissionsWalkthrough.js:113:66)
at async Object.createWalkthrough (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/service-walkthroughs/lambda-walkthrough.js:53:83)
at async addFunctionResource (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/index.js:78:9)
at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/amplify-category-function/lib/index.js:267:5)
at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:142:5)
at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:40:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:153:5)
You can access the following resource attributes as environment variables from your Lambda function
ENV
REGION
? Do you want to invoke this function on a recurring schedule? (y/N)
### Project Identifier
_No response_
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
### Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Contributor guide
Assessment
This issue has not been assessed yet.