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

Usage example not working on AWS Python 3.6 #249

Open
XerTheSquirrel opened this issue Jul 13, 2018 · 12 comments
Open

Usage example not working on AWS Python 3.6 #249

XerTheSquirrel opened this issue Jul 13, 2018 · 12 comments
Labels

Comments

@XerTheSquirrel
Copy link

Description

Following the README, the minimalist sample does not seem to work at all on Python 3.6. The README does say "This package supports Python 2.7 and 3.6, the runtimes supported by AWS Lambda.".

Steps to reproduce the issue:

  1. Setup new Lambda.
  2. Choose Python 3.6
  3. Follow https://github.com/iopipe/iopipe-python#installation
  4. Follow https://github.com/iopipe/iopipe-python#usage
  5. Create index.py
  6. Place as contents:
from iopipe import IOpipe
iopipe = IOpipe('token')

@iopipe
def lambda_handler(event, context):
    pass
  1. Set entry point to: index.lambda_handler
  2. Save it
  3. Test it with anything

Describe the results you received:

Response:
{
  "errorMessage": "Syntax error in module 'index'"
}

Request ID:
"102bedeb-86bf-11e8-8562-97ea3fe2926e"

Function Logs:
START RequestId: 102bedeb-86bf-11e8-8562-97ea3fe2926e Version: $LATEST
Syntax error in module 'index': invalid syntax (_base.py, line 414)

END RequestId: 102bedeb-86bf-11e8-8562-97ea3fe2926e
REPORT RequestId: 102bedeb-86bf-11e8-8562-97ea3fe2926e	Duration: 0.83 ms	Billed Duration: 100 ms 	Memory Size: 128 MB	Max Memory Used: 22 MB	

Describe the results you expected:

Expected the lambda to pass.

Additional information you deem important (e.g. issue happens only occasionally):

Switching to Python 2.7 works.

@kolanos
Copy link
Contributor

kolanos commented Sep 25, 2018

@XerTheSquirrel This line:

Syntax error in module 'index': invalid syntax (_base.py, line 414)

Appears to be referencing AWS Lambda's own bootstrap system. There is no _base.py in the iopipe module.

@kolanos
Copy link
Contributor

kolanos commented May 15, 2019

Closing as unable to reproduce.

@kolanos kolanos closed this as completed May 15, 2019
@mateusfccp
Copy link

I'm also having this problem with my application. It was running stable on production for almost a year and suddenly, in a new deploy, it started to throw this error.

@pramodsetlur
Copy link

I am seeing the issue as well.

@kolanos kolanos reopened this Jul 19, 2019
@kolanos
Copy link
Contributor

kolanos commented Jul 19, 2019

@pramodsetlur, @mateusfccp Any details to help reproduce? Are you both getting the same traceback? Is this with Serverless or something else?

@kolanos
Copy link
Contributor

kolanos commented Jul 19, 2019

@pramodsetlur, @mateusfccp Is the futures package installed? IOpipe installs a futures package on python2.7 which is a backport of concurrent.futures which is only available in python3.x. However, if you are running python2.7 locally and install IOpipe and then deploy to python3.6 the futures package will be included which may result in this error. Solution is to ensure that futures is not included in your python3.6 deployment.

@pramodsetlur
Copy link

@kolanos Apologies; I am not using iopipie; My error is more related just to Lambda. I am deploying with serverless. It runs successfully with 3.7 on local and crashes with the same error Syntax error in module 'index': invalid syntax (_base.py, line 414) on Lambda 3.6. I changed it to 2.7 and it worked fine.
(So, my message might not be relevant to iopipe at all.)

@kolanos
Copy link
Contributor

kolanos commented Jul 23, 2019

@pramodsetlur I traced the invalid syntax (_base.py, line 414) back to the futures backport. So it is possible you're still running into that issue even without IOpipe being present.

@kolanos
Copy link
Contributor

kolanos commented Jul 23, 2019

@pramodsetlur If you're willing to give IOpipe another try, we have a new layers plugin for Serverless that doesn't require a code change:
https://github.com/iopipe/serverless-iopipe-layers

@kolanos kolanos closed this as completed Jul 23, 2019
@pramodsetlur
Copy link

@kolanos I only commented on this issue because i was seeing the particular error in _base.py. Was never using iopipie. But appreciate the responses.

@jonahjon
Copy link

The fix for this is to change either

  1. Use pip3 install for lambda runtimes of 3.X
  2. Delete the folder in your packaged concurrent/futures/

@kolanos
Copy link
Contributor

kolanos commented Aug 19, 2019

Going to add this to a troubleshooting section in the README.

@kolanos kolanos reopened this Aug 19, 2019
migurski added a commit to PlanScore/PlanScore that referenced this issue Mar 12, 2021
migurski added a commit to PlanScore/PlanScore that referenced this issue Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants