Serverless plugin "serverless-iam-roles-per-function" not found in GHA
ryanbell1997 opened this issue · comments
Issue description
I have a GHA workflow to deploy a couple of Lambda functions which has been working absolutely fine for weeks, perhaps even months now. This morning however, I've tried running the workflow and I've been encountering issues.
This is the error I get
✖ Serverless plugin "serverless-iam-roles-per-function" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file. Run "serverless plugin install -n serverless-iam-roles-per-function" to install it.
ServerlessError: Serverless plugin "serverless-iam-roles-per-function" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file. Run "serverless plugin install -n serverless-iam-roles-per-function" to install it.
at PluginManager.resolveServicePlugins (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:46444:[15](https://github.com/RyanBellOrg/ActivityLogger/actions/runs/8951737441/job/24588384862#step:13:16))
at async PluginManager.loadAllPlugins (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:46352:36)
at async Serverless.init (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:48530:5)
at async runFramework (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:49058:5)
at async route (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:50819:10)
at async Object.run$1 [as run] (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:50935:3)
at async Object.handler (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:51127:7)
For help, try the following:
• Run the command again with the "--debug" option
• Run "serverless support"
• Review the docs: https://www.serverless.com/framework/docs/
The Workflow file (key steps)
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: |
npm i @serverless/v4 -g
npm install
- name: Serverless Support
run: serverless support --summary
- name: Deploy to AWS
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
run: sls deploy
Serverless.yml
service: ActivityLogger
plugins:
- serverless-iam-roles-per-function
I cannot make sense of it at all. Is this a problem that only I am having?
Context
Serverless ϟ Support
This generates a report from your last Serverless Framework command (including any errors) to use for Github Issues, debugging w/ AI, or creating a support ticket w/ Serverless Inc.
Summary Report -----------------
Service Overview
- Serverless Framework Version: 4.0.0
- Service Config File: serverless.yml
- Service Name: ActivityLogger
- Service Runtime: dotnet8
- Service Stage: dev
- Service Region: eu-west-2
- Command: deploy
- Error Code: PLUGIN_NOT_FOUND
Service Path
/home/runner/work/ActivityLogger/ActivityLogger
Error Message
Serverless plugin "serverless-iam-roles-per-function" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file. Run "serverless plugin install -n serverless-iam-roles-per-function" to install it.
Error Stacktrace
at PluginManager.resolveServicePlugins (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:46444:[15](https://github.com/RyanBellOrg/ActivityLogger/actions/runs/8951798750/job/24588507562#step:13:16))
at async PluginManager.loadAllPlugins (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:46352:36)
at async Serverless.init (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:48530:5)
at async runFramework (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:49058:5)
at async route (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:508[19](https://github.com/RyanBellOrg/ActivityLogger/actions/runs/8951798750/job/24588507562#step:13:20):10)
at async Object.run$1 [as run] (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:50935:3)
at async Object.handler (/snapshot/framework-core/packages/sf-core/dist/sf-core.cjs:51127:7)
@ryanbell1997 Are you able to run the command npm install --save-dev serverless-iam-roles-per-function
within that workflow to ensure that the plugin is installed with npm and try again?
Hey @garethmcc I can do. I did try adding it as a separate line, but I had the same issue. 🤔
Now I'm getting this
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'timers' imported from /home/runner/.serverless/releases/4.0.[13](https://github.com/RyanBellOrg/UserProfileLambdas/actions/runs/9085925608/job/24970390196#step:12:14)/package/dist/sf-core.js
at new NodeError (internal/errors.js:322:7)
at packageResolve (internal/modules/esm/resolve.js:732:9)
at moduleResolve (internal/modules/esm/resolve.js:773:18)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:887:11)
at Loader.resolve (internal/modules/esm/loader.js:89:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
at link (internal/modules/esm/module_job.js:75:36) {
code: 'ERR_MODULE_NOT_FOUND'
Why do I need timers? :-)
I did try npm install timers, but no luck.
This was solved by using Nodejs v20+.