-
Notifications
You must be signed in to change notification settings - Fork 406
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
Bug: v2.16.1 [ERROR] Runtime.ImportModuleError: Unable to import module 'src.generate_token': aws-lambda-powertools Traceback (most recent call last): #2381
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hello @bronzeson! Thank you very much for opening this issue and reporting that. We really want to understand if this is I tried to reproduce it here but I couldn't. Could you please check my steps and see if I'm missing something? mkdir testlayer
cd testlayer
python -m venv .env
source .env/bin/activate
echo aws_lambda_powertools > requirements.txt
pip install -r requirements.txt
mkdir python
cp -pR .env/lib/python3.10/site-packages/* python
zip -r layer.zip python
aws lambda publish-layer-version --layer-name "test-layer-issue-2381" --region=us-east-1 --zip-file "fileb://layer.zip" |
I am adding the |
Runtime.ImportModuleError is typically a build error - another dependency
that makes use of C-extensions end up being built in another architecture
then fail at runtime.
If you could share how you’re building these layers, and what else is in
your dependencies (requirements.txt), we should be able to get close to
your environment.
If it’s on us, we’ll happily make a patch release ASAP
…On Mon, 5 Jun 2023 at 22:23, Leandro Damascena ***@***.***> wrote:
I am adding the cant-reproduce label for now.
—
Reply to this email directly, view it on GitHub
<#2381 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBEY42IUUV7GSLQ57X3XJY54LANCNFSM6AAAAAAY3NLJM4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
I had a similar issue yesterday that might be related and help shed some light on the issue. I received the following error in our cloudwatch logs when attempting to use v2.16.1 but no error with v2.15.0:
I'm deploying a lambda using the serverless framework (with serverless-python-requirements) using a pipfile with the following line: we are using Python 3.10 |
This is super useful @CJTurpie, thank you so much for jumping in. This means the We'll look into a solution that works for any custom build now and release 2.16.2. |
Got a solution that is safe to use in prod. Testing one more time before we merge and kick off a patch release. |
Making a test release to triple check: https://github.com/heitorlessa/aws-lambda-powertools-test/actions/runs/5186318297 |
Kicked off prod release: https://github.com/awslabs/aws-lambda-powertools-python/actions/runs/5186799960 |
Everyone - It's now available in PyPi 2.16.2. Building layers to deploy across all AWS regions (+canary testing etc etc.) Next Layer version will be 34. Appreciate everyone's patience while we tested corner cases out. |
This is now released under 2.16.2 version! |
release completed: PyPi (2.16.2), Layer (34). Latest docs might take a few minutes for CDN to invalidate etc. @bronzeson @CJTurpie @dionearle - would you mind triple checking with your build please? I've tested with the latest Serverless framework and python-requirements plugin but want to be sure before we close it. Thank you! |
That seems to have fixed my issue |
Great! Thank you, Carl!
…On Tue, 6 Jun 2023 at 12:31, Carl Turpie ***@***.***> wrote:
That seems to have fixed my issue
—
Reply to this email directly, view it on GitHub
<#2381 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBHP23VA5ZV3W5WMIDLXJ4BH7ANCNFSM6AAAAAAY3NLJM4>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***
com>
|
I'm closing it, please feel free to reopen otherwise @bronzeson. Confirmed with other customers it's a non-issue in the latest release. |
|
We were indeed using serverless too. I was able to test successfully with the new release 😃 |
Expected Behaviour
Expected our lambdas to run normally with the new version of aws-lambda-powertools
Current Behaviour
We get errors on importing aws-lambda-powertools with v2.16.1, but v2.15.0 works fine.
We experienced errors on all of our lambdas that use aws-lambda-powertools with 2.16.1. We import 'aws_lambda_powertools' in a requirements.txt file in a layer.
Then we attach that layer to a lambda. The lambda calls import like this
'''
from aws_lambda_powertools import Logger
'''
This is where we get the failure:
'''
[ERROR] Runtime.ImportModuleError: Unable to import module 'src.generate_token': aws-lambda-powertools Traceback (most recent call last):
'''
There is no other information, and it is really difficult to tell why it is failing. But pinning the requirements.txt file to 2.15.0 fixed everything.
Code snippet
Possible Solution
Roll back to 2.15.0
Steps to Reproduce
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.9
Packaging format used
Lambda Layers
Debugging logs
No response
The text was updated successfully, but these errors were encountered: