requests / requests-oauthlib

OAuthlib support for Python-Requests!
https://requests-oauthlib.readthedocs.org/
ISC License
1.71k stars 422 forks source link

This is not available on aws lambda. #445

Closed ninoko1995 closed 2 years ago

ninoko1995 commented 3 years ago

This package is not available on aws lambda. If I try to use this by from requests_oauthlib import OAuth1Session, aws emits below error. Please resolve this problem!

Response
{
  "errorMessage": "Unable to import module 'lambda_function': cannot import name 'OAuth1Session' from 'requests_oauthlib' (unknown location)",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []
}

Function Logs
START RequestId: 688ffcb5-9729-40ef-93c7-a9f67455172d Version: $LATEST
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': cannot import name 'OAuth1Session' from 'requests_oauthlib' (unknown location)
Traceback (most recent call last):END RequestId: 688ffcb5-9729-40ef-93c7-a9f67455172d
REPORT RequestId: 688ffcb5-9729-40ef-93c7-a9f67455172d  Duration: 1.74 ms   Billed Duration: 2 ms   Memory Size: 128 MB Max Memory Used: 50 MB  Init Duration: 124.92 ms

Request ID
688ffcb5-9729-40ef-93c7-a9f67455172d

The directory structure is here.

スクリーンショット 2021-05-16 14 51 15
GonzaloSaad commented 3 years ago

That's a weird problem! Have you checked the value of PYTHONPATH? I think the problem may be there.

I'm using this lib on AWS Lambda without any problem. Still, like most of the third-party libraries, you need to be sure to add it into the packaging when deploying the function, in more simple terms, be sure this is added into the zip that it's uploaded.

JonathanHuot commented 2 years ago

Closing as it is a packaging issue not related to requests-oauthlib