aws-secrets-manager-rotation-lambdas icon indicating copy to clipboard operation
aws-secrets-manager-rotation-lambdas copied to clipboard

Help with this error - Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': invalid syntax

Open vitarkah opened this issue 3 years ago • 2 comments

So did the following to prepare the depedency package pip install --target ./package pg pip install --target ./package pgdb cd package zip -r ../deployment.zip .

[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': invalid syntax (init.py, line 3) Traceback (most recent call last):   File "/var/task/pg/init.py" Line 3         async,

Tried with python 3.6, 3.7 & 3.8; no luck; googling does not seem to help much either...

vitarkah avatar Nov 06 '21 18:11 vitarkah

Thank you for opening this issue - we are looking into it.

whygoyal avatar Mar 02 '22 20:03 whygoyal

Any update on this?

samdavies1906 avatar Sep 02 '22 08:09 samdavies1906

+1 experiencing the same issue using python 3.9. Curious, why this lambda is relying on Python OpenGL Graphics Framework for logging. Maybe it's a typo?

Pacobart avatar Oct 04 '22 19:10 Pacobart

Hello,

For this PostgreSQL rotation function, the names of the python modules that are imported by the function are not the same as the python package that needs to be installed. Unfortunately, this has been a cause of confusion. We have updated our README to link to our public documentation where the correct dependencies and current supported versions are outlined for each function.

For quick reference, here is the relevant link in this case: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_available-rotation-templates.html#sar-template-postgre-singleuser

JoeJesse avatar Oct 06 '22 17:10 JoeJesse

Can you publish the requirements.txt file to use and what version of python to use.

JeffH72 avatar Oct 20 '22 12:10 JeffH72

We are continuing to evaluate posting the requirements.txt file in the repositories, but for now the dependencies are posted to our documentation link listed above by @JoeJesse. Closing this ticket.

jbct avatar May 15 '23 18:05 jbct