"'NoneType' object is not callable" when running on Lambda
See original GitHub issueIβm trying to get this to successfully run in an AWS Lambda function and keep getting the error:
Traceback (most recent call last):
File "handler.py", line 27, in <module>
rsa_private_key_passphrase = boxPrivateKeyPassphrase
TypeError: 'NoneType' object is not callable
The area where itβs failing is:
enterpriseAuth = JWTAuth(
client_id=boxClientId,
client_secret=boxClientSecret,
enterprise_id=boxEnterpriseId,
jwt_key_id=boxJwtKeyId,
rsa_private_key_file_sys_path=boxPrivateKeyPath,
rsa_private_key_passphrase=boxPrivateKeyPassphrase
)
I could duplicate it on an EC2 instance with modules packaged with the script in a vendored directory.
.
βββ boxsdk
βΒ Β βββ auth
βΒ Β βββ client
βΒ Β βββ network
βΒ Β βββ object
βΒ Β βββ session
βΒ Β βββ util
βββ boxsdk-1.5.3.dist-info
βββ enum
βββ enum34-1.1.6.dist-info
βββ idna
βββ idna-2.1.dist-info
βββ ipaddress-1.0.16.dist-info
βββ jwt
βΒ Β βββ contrib
βββ pkg_resources
βΒ Β βββ extern
βΒ Β βββ _vendor
βββ pyasn1
βΒ Β βββ codec
βΒ Β βββ compat
βΒ Β βββ type
βββ pyasn1-0.1.9.dist-info
βββ pycparser
βΒ Β βββ ply
βββ pycparser-2.14.egg-info
βββ PyJWT-1.4.0.dist-info
βββ requests
βΒ Β βββ packages
βββ requests-2.10.0.dist-info
βββ requests_toolbelt
βΒ Β βββ adapters
βΒ Β βββ auth
βΒ Β βββ cookies
βΒ Β βββ downloadutils
βΒ Β βββ multipart
βΒ Β βββ threaded
βΒ Β βββ utils
βββ requests_toolbelt-0.6.2.dist-info
βββ setuptools
βΒ Β βββ command
βΒ Β βββ extern
βββ setuptools-24.0.2.dist-info
βββ six-1.10.0.dist-info
The only way to get it to work on EC2 is by sudo pip install boxsdk[jwt]
on the system packages after installing a number of dependencies like libffi-devel, gcc and openssl-devel.
So does anyone know whatβs missing that I could bundle with the function into Lambda in order to get this working?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Python: <lambda> TypeError: 'NoneType' object is not ...
I am trying to call a function called Add_user from another function called Edit_user_admin , I'm pretty sure I have written everythingΒ ...
Read more >Python TypeError: 'nonetype' object is not callable Solution
βTypeError : 'nonetype' object is not callableβ occurs when you try to call a None value as if it were a function. ......
Read more >TypeError: 'NoneType' object is not callable in Python
The Python "TypeError: 'NoneType' object is not callable" occurs when we try to call a None value as if it were a function....
Read more >TypeError: 'NoneType' object is not callable : r/aws
I'm running into an error after deploying my django app to lambda ... to lambda using zappa - TypeError: 'NoneType' object is not...
Read more >"TypeError: 'NoneType' object is not callable" raised when ...
Just run Debug and check console over and over again. ... Found in pycharmPY-142.4957 build. ... I've had the same crash on 2019.2...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See https://github.com/box/box-python-sdk/blob/master/boxsdk/auth/__init__.py#L10 .
JWTAuth
is only defined if its dependencies are available (which you get withpip install boxsdk[jwt]
). If youβre using a Pythonvirtualenv
, you should make sure these dependencies are installed into yourvirtualenv
withpip
. If youβre running directly with the systemβs python, youβll needsudo pip
.Compiling the
cryptography
dependency on Linux does requirelibffi-devel
,gcc
andopenssl-devel
: https://github.com/pyca/cryptography/blob/master/docs/installation.rst#building-cryptography-on-linuxI donβt know anything about Lambda, so I donβt know what would be different about getting it to work on Lambda, as opposed to EC2. In the directory tree you posted, I donβt see
cryptography
, which is probably whyJWTAuth
isnβt able to be imported and defined.was the issue solved? Iβm getting this error as well. Here is my tree, did both boxsdk[jwt] and cryptography. Everything was compiled on AmazonLinux docker.
. βββ asn1crypto βΒ Β βββ _perf βββ asn1crypto-0.24.0.dist-info βββ bin βββ boxsdk βΒ Β βββ auth βΒ Β βββ client βΒ Β βββ network βΒ Β βββ object βΒ Β βββ session βΒ Β βββ util βββ boxsdk-1.5.5.dist-info βββ certifi βββ certifi-2018.4.16.dist-info βββ cffi βββ cffi-1.11.5.dist-info βββ chardet βΒ Β βββ cli βββ chardet-3.0.4.dist-info βββ cryptography βΒ Β βββ hazmat βΒ Β βΒ Β βββ backends βΒ Β βΒ Β βΒ Β βββ openssl βΒ Β βΒ Β βββ bindings βΒ Β βΒ Β βΒ Β βββ openssl βΒ Β βΒ Β βββ primitives βΒ Β βΒ Β βββ asymmetric βΒ Β βΒ Β βββ ciphers βΒ Β βΒ Β βββ kdf βΒ Β βΒ Β βββ twofactor βΒ Β βββ x509 βββ cryptography-2.2.2.dist-info βββ enum βββ enum34-1.1.6.dist-info βββ idna βββ idna-2.6.dist-info βββ ikpdb-1.2.3.dist-info βββ ipaddress-1.0.22.dist-info βββ pycparser βΒ Β βββ ply βββ pycparser-2.18.dist-info βββ requests βββ requests-2.18.4.dist-info βββ requests_toolbelt βΒ Β βββ adapters βΒ Β βββ auth βΒ Β βββ cookies βΒ Β βββ downloadutils βΒ Β βββ multipart βΒ Β βββ threaded βΒ Β βββ utils βββ requests_toolbelt-0.8.0.dist-info βββ six-1.11.0.dist-info βββ urllib3 βΒ Β βββ contrib βΒ Β βΒ Β βββ _securetransport βΒ Β βββ packages βΒ Β βΒ Β βββ backports βΒ Β βΒ Β βββ ssl_match_hostname βΒ Β βββ util βββ urllib3-1.22.dist-info
Any idea?