serverless-components/aws-lambda

Are layers actually supposed to work?

jedfoster opened this issue · 2 comments

I'm trying to add a layer to my lambda, but the following doesn't appear to have any effect:

  component: '@serverless/aws-lambda'
  inputs:
    code: ./
    handler: handler.info
    description: Info endpoint for ${name}
    region: us-west-2
    runtime: nodejs12.x
    layers:
      - arn:aws:lambda:us-west-2:XXXXXXXXX:layer:commoncode:1

The layer already exists, but it isn't being added to lambda.

So, it looks like #15 was closed without being merged. I tried layer: arn:aws:lambda:us-west-2:XXXXXXXXX:layer:commoncode:1 and that at least spits out the layer info at the end of the sls command:

 info:
    name:        9eg2ee-...
    hash:        ...
    description: Info endpoint for service-abc
    memory:      512
    timeout:     10
    code:        ./
    bucket:      undefined
    shims:       (empty array)
    handler:     handler.info
    runtime:     nodejs12.x
    env:
      name: service-abc
    role:
      arn: arn:aws:iam:: XXXXXXXXX:role/9eg2ee-s0brcjs
    layer:       arn:aws:lambda:us-west-2: XXXXXXXXX:layer:commoncode:1
    arn:         arn:aws:lambda:us-west-2: XXXXXXXXX:function:9eg2ee-kswhuoz
    region:      us-west-2

But the layer is still not associated with the lambda in the AWS console.

One final note for today: the good news—for me, at least—is that I can add a layer manually in the AWS console and subsequent serverless deploy commands have no adverse effects.

I'd still like to know if adding layers via serverless.yml is supposed to work; if so, what am I doing wrong?