serverless-offline icon indicating copy to clipboard operation
serverless-offline copied to clipboard

Layer download issue

Open wfernandezgb opened this issue 3 years ago • 4 comments

Working with Layers in AWS encountered an issue trying to execute the lambda in local environment. It appears the ARN is not being passed correctly when it tries to download and create a folder. But it works correctly when it gets deployed to AWS instances.

Tracking down the issue it seems that the DockerContainer.js file in the method _downloadLayer receives an inccorrect parameter.

Stacktrace: offline: Found layers, checking provider type offline: Found layers, checking provider type offline: Storing layers at /home/walter.fernandez/code/distribution-serverless-product/.serverless-offline/layers/1d519f58f635a45ca77575ee4b8ed4c9fe588b7bbf0710187972f8f3fe6e16d0 offline: Getting layers offline: Failure: layerArn.split is not a function TypeError: layerArn.split is not a function

Version: Serverless-offline 7.0.0

Please can anyone help me solve this issue.

wfernandezgb avatar Aug 25 '21 21:08 wfernandezgb

Do you build the layer ARN dynamically via "Ref" + "logicalId"? (I have the same problem!) If so I can't see any easy solutions. But I don't know all the intricacies of the code.

layers: [
    { Ref: 'NodeJSLambdaLayer' }
  ]

My unsplittable layerArn is { Ref: 'NodeJSLambdaLayer' }

gparonitti avatar Oct 04 '21 15:10 gparonitti

Did you find any workaround for this issue?

itoche avatar Jan 16 '22 11:01 itoche

anyone I have the same issue

ealexisaraujo avatar Mar 01 '22 21:03 ealexisaraujo

seem that it not works when I import layers like

layers:
  - { Ref: TestLambdaLayer }

it works for me when i changed to paste the arn of layer copied from aws console.

layers:
  - arn:aws:lambda:region:XXXXXX:layer:LayerName:Y

phan-nhat avatar Apr 15 '22 07:04 phan-nhat