keithrozario / Klayers

Python Packages as AWS Lambda Layers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Layer suddenly stopped working

markservantesii opened this issue · comments

Describe the bug
Importing pandas results in the following error:

[ERROR] Runtime.ImportModuleError: Unable to import module 'main': cannot import name 'DtypeArg' from 'pandas._typing' (/opt/python/pandas/_typing.py)

This suddenly started happening some time after Friday July 2nd 2021. I use this layer in two different Lambdas, all of which stopped working with the error message above.

Screenshots
If applicable, add screenshots to help explain your problem.

Layer Version ARN:
Arn: arn:aws:lambda:us-east-1:770693421928:layer:Klayers-python38-pandas:35
Region: us-east-1
Runtime: python3.8

Framework:
Console / CloudFormation

Additional context
Add any other context about the problem here.

Thanks @markservantesii .

Can you explain further what "This suddenly started happening some time after Friday July 2nd 2021." means.

Did you have the layers in a function before July 2nd, and only after July 2nd it started failing?

Hi @keithrozario -

I have two different Lambdas using the layer. Both were working as expected on Friday July 2nd. On Tuesday July 6th they no longer worked and would result in the error message I posted above. I had made no changes to the Lambda functions between the time when they were last known to be working and when I noticed they stopped working. I had not changed the Layer version either. When I removed the layers and replaced with a custom one, my Lambdas began working as expected.

It appears that something changed between 2021-07-02 and 2021-07-06. I assume there is no way to publish Layer updates without publishing a new Layer version. Since the Lambdas began failing while using the same Layer version, I suspect something changed on the AWS / Lambda backend to suddenly cause an incompatibility with the Layer.

Interesting, as you say, the layers are immutable, I can't change them (even if I wanted to). So this issue is doubly strange.