localstack
localstack copied to clipboard
bug: Lambda layers are not working properly; cannot add them via terraform, nor view their version or description when added via UI
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
I am trying to attach a lambda layer to my lambda function and have tried in 2 ways: 1. manually upload the .zip file via the UI in browser and 2. include the .zip file in the terraform configuration for my lambda function. Neither seem to work right. Option 1 leads to showing the layers, but clicking on them brings me to a blank page (ss1 & ss2).
Executing "awslocal lambda list-layers" yields:
2024-03-20 22:48:54 2024-03-21T02:48:54.623 INFO --- [ asgi_gw_1] localstack.request.http : OPTIONS /2018-10-31/layers => 204 2024-03-20 22:48:54 2024-03-21T02:48:54.634 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: list index out of range 2024-03-20 22:48:54 2024-03-21T02:48:54.635 INFO --- [ asgi_gw_0] localstack.request.aws : AWS lambda.ListLayers => 500 (InternalError)
Sometimes, instead, the error is: 2024-03-20 22:43:42 2024-03-21T02:43:42.616 WARN --- [ asgi_gw_1] l.aws.protocol.serializer : Response object LayerVersionsListItem contains a member which is not specified: Content
Sometimes if I try to manually add another layer it gives me an endlessly refreshing "No data to display" blank layers screen.
Option 2 just doesn't work, with the terraform defined layer never appearing in the UI.
Pointing the Lambda.tf at the layers viewable in SS1 (assuming the version is 1) gives me errors during lambda invokation that packages I had defined in the layers can't be resolved.
I would typically err towards "I must be doing something wrong" but the fact that I can't even get a consistent error behavior (sometimes the layers show up but lead to blank screen when clicked, other times - with no interim steps - they disappear entirely and yield index out of range errors). Seems broken somehow.
I am using Pro (on a trial version. I know pro is active as I can deploy RDS.
Expected Behavior
I'd like to be able to click into the layers and not have the screen glitch to an empty box. I'd like to be able to define the layer via the lambda.tf and have it not give me the runtime error that it can't resolve the module.
How are you starting LocalStack?
Custom (please describe below)
Steps To Reproduce
With the command "localstack start -d"
Environment
- OS: macOS
- LocalStack: latest
Anything else?
No response
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.
Think this may be due to my using of a version of the psycopg-2 binary that is incompatible with Lambda's Linux OS.
Hi @AlekPiasecki
Thank you for reporting these issues. Let me try to break them down.
WebApp Layer Detail View
I can confirm that the Web application "brings me to a blank page" once clicking on a Lambda layer. I forwarded this issue to the web team.
ListLayers 500 error
I cannot reproduce the functional issues and created a working Terraform Lambda Layer sample here: https://github.com/joe4dev/localstack-lambda-layer-python-terraform-sample
Can you please share the detailed steps to reproduce these errors upon awslocal lambda list-layers? Does this only happen with specific layer content?
2024-03-20 22:48:54 2024-03-21T02:48:54.623 INFO --- [ asgi_gw_1] localstack.request.http : OPTIONS /2018-10-31/layers => 204 2024-03-20 22:48:54 2024-03-21T02:48:54.634 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: list index out of range 2024-03-20 22:48:54 2024-03-21T02:48:54.635 INFO --- [ asgi_gw_0] localstack.request.aws : AWS lambda.ListLayers => 500 (InternalError)
2024-03-20 22:43:42 2024-03-21T02:43:42.616 WARN --- [ asgi_gw_1] l.aws.protocol.serializer : Response object LayerVersionsListItem contains a member which is not specified: Content
Can you confirm that the same Lambda function and Layer package deploy successfully against AWS?
Think this may be due to my using of a version of the psycopg-2 binary that is incompatible with Lambda's Linux OS.
Please ensure that the Lambda function and layer packages are build for the correct architecture and platform. The AWS documentation has more detailed instructions here: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html#python-package-native-libraries
Hello 👋! It looks like this issue hasn’t been active in longer than two weeks. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.