Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding disableLogs: true to lambda config makes plugin throw an error #102

Open
markgibaud-vtail opened this issue Mar 16, 2022 · 3 comments

Comments

@markgibaud-vtail
Copy link

markgibaud-vtail commented Mar 16, 2022

Hi there,

I have the following config in Serverless.yml for a lambda:

asyncSyncProductsDb:
    handler: functions/asyncSyncProductsDb/asyncSyncProductsDb.main
    timeout: 300
    memorySize: 2048
    events:
       //eventbridge event source
    iamRoleStatements:
      - Effect: Allow
        Action:
          - ssm:GetParameters
          - ses:SendEmail
        Resource:
          - '*'

Now I want to temporarily disable creation of the log group, in order to later re-enable & recreate it in a nested stack using serverless-plugin-split-stacks custom config. However when I add disableLogs: true as per the docs I get an error:

asyncSyncProductsDb:
    handler: functions/asyncSyncProductsDb/asyncSyncProductsDb.main
    disableLogs: true
    timeout: 300
    memorySize: 2048
    events:
       //eventbridge event source
    iamRoleStatements:
      - Effect: Allow
        Action:
          - ssm:GetParameters
          - ses:SendEmail
        Resource:
          - '*'
Serverless Error ----------------------------------------

  serverless-iam-roles-per-function: ERROR: Function Resource is not in expected format. For function name: asyncSyncProductsDb

The plugin is throwing this error even though my lambda config is fine.

If I comment out the iamRoleStatements then it works fine and deletes the log group, ostensibly because this plugin does not process the lambda config.

Any ideas on fixes or workarounds? I need to do this to about 30 lambdas :-)

@markgibaud-vtail
Copy link
Author

My plugins order, in case that helps!

plugins:
  - serverless-webpack
  - serverless-export-env
  - serverless-appsync-plugin
  - serverless-plugin-datadog
  - serverless-prune-plugin
  - serverless-step-functions
  - serverless-iam-roles-per-function
  - serverless-plugin-split-stacks
  - serverless-plugin-git-variables

@drobakowski
Copy link

Any update on this? We're running into the same problems... :/

@andersquist
Copy link
Collaborator

Since the original maintainer is the only one holding the keys to both fix the builds that are failing and being able to publish to NPM and seems to have abandoning this I've taken the steps to workaround this and is currently publishing this in a parallell plugin named serverless-iamroles.

The fork can be found here:
https://github.com/andersquist/serverless-iam-roles-per-function

I've also made a PR to fix this specfic issue if you want to take a look as mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants