Skip to content
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

UUID dependency issue with python 3 in AWS Lambda #16

Open
TrafficScone opened this issue Jul 3, 2022 · 1 comment
Open

UUID dependency issue with python 3 in AWS Lambda #16

TrafficScone opened this issue Jul 3, 2022 · 1 comment

Comments

@TrafficScone
Copy link

Description
Loading webptools in default AWS python 3.9 environment fails due to an error related to uuid:

{
  "errorMessage": "Syntax error in module 'lambda_function': invalid syntax (uuid.py, line 138)",
  "errorType": "Runtime.UserCodeSyntaxError",
  "requestId": "c644d245-fa99-456d-a8ad-edcad99a1bd9",
  "stackTrace": [
    "  File \"/var/task/uuid.py\" Line 138\n                if not 0 <= time_low < 1<<32L:\n"
  ]
}

Expected behavior
Successful execution of simple script:

from webptools import cwebp

def lambda_handler(event, context):
    # Initialize variable from S3 event (ObjectCreated:Put)
    print('Initializing variables . . .')
    map_filename = event['Records'][0]['s3']['object']['key']
    map_name = map_filename.split('.')[0]

    print(map_name)
    return map_name

Steps to reproduce
Try to load the package in an AWS Lambda environment

Steps to fix
Believe this can be fixed if uuid is removed from setup.py since it is now included since the default uuid library is included in the python standard library (similar error)

@HarshitRuwali
Copy link

This have nothing to do with the lambda function, but its an error from your end.

You dont have to install the uuid package, and deploy in lambda.

If you are zipping and pushing to lambda (eg. via sls) then uninstall the uuid from local, or else if you are using docker images via ECR, remove the uuid from requirements.txt file.

Ref this StackOverflow answer: https://stackoverflow.com/questions/33612977/how-to-use-uuid-lib-with-mod-wsgi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants