I'm trying to generate a token with uuid in lambda with Python 3.12 runtime. I installed last uuid in my local venv with Python 3.12 and use it as lamdba layer, but have the problem:
[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': invalid decimal literal (uuid.py, line 138)
Traceback (most recent call last):
File "/opt/python/lib/python3.12/site-packages/uuid.py" Line 138
if not 0 <= time_low < 1<<32L:
Here is my code:
import uuid
def lambda_handler(event, context):
.
.
.
if response.status_code == 200:
tokens = response.json()
print("Token de acceso obtenido de Spotify: ", tokens['access_token'])
session_token = str(uuid.uuid4())
try:
response = table.put_item(
Item={
'session_token': session_token,
'access_token': tokens['access_token'],
'refresh_token': tokens['refresh_token'],
# Puedes guardar tambiΓ©n otros datos como 'expires_in', 'scope', etc.
}
)
Is not a problem of lambda layers because all libraries are importing ok, also install the last version on uuid with pip, so I don't know what the problem is :(
I just delete uuid library from the Lambda Layer, so it seems that by default Python3.12 have uuid in AWS Lambda π π π π
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With