Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error trying to access S3 from lambda(python)

I am trying to access S3 from lambda(zappa+flask+python),

class Logicos ( ) :
  def newlogics() : 
     s3 = boto3.resource('s3') 
     return "It's Working"

I get the below error on line s3 = boto3.resource('s3'):

1571927898414] File "/var/task/newlogic_serverless.py", line 34, in newlogics


 [1571927898414] s3 = boto3.resource('s3')
[1571927898414] File "/var/runtime/boto3/__init__.py", line 100, in resource
[1571927898414] return _get_default_session().resource(*args, **kwargs)
[1571927898414] File "/var/runtime/boto3/session.py", line 389, in resource
[1571927898414] aws_session_token=aws_session_token, config=config)
[1571927898414] File "/var/runtime/boto3/session.py", line 263, in client
[1571927898414] aws_session_token=aws_session_token, config=config)
[1571927898414] File "/var/runtime/botocore/session.py", line 827, in create_client

[1571927898414] credentials = self.get_credentials()
[1571927898414] File "/var/runtime/botocore/session.py", line 426, in get_credentials
[1571927898414] 'credential_provider').load_credentials()
[1571927898414] File "/var/runtime/botocore/session.py", line 903, in get_component
[1571927898414] self._components[name] = factory()
[1571927898414] File "/var/runtime/botocore/session.py", line 145, in <lambda>
[1571927898414] lambda:  botocore.credentials.create_credential_resolver(self))
[1571927898414] File "/var/runtime/botocore/credentials.py", line 70, in create_credential_resolver
[1571927898414] container_provider = ContainerProvider()
[1571927898414] File "/var/runtime/botocore/credentials.py", line 1789, in __init__
[1571927898414] fetcher = ContainerMetadataFetcher()
[1571927898414] File "/var/runtime/botocore/utils.py", line 1238, in __init__
[1571927898414] timeout=self.TIMEOUT_SECONDS
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 179, in __init__
[1571927898414] self._manager = PoolManager(**self._get_pool_manager_kwargs())
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 187, in _get_pool_manager_kwargs
[1571927898414] 'ssl_context': self._get_ssl_context(),
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 196, in _get_ssl_context
[1571927898414] return create_urllib3_context()
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 71, in create_urllib3_context
[1571927898414] context.options |= options
[1571927898414] File "/var/lang/lib/python3.7/ssl.py", line 518, in options
[1571927898414] super(SSLContext, SSLContext).options.__set__(self, value)
[1571927898414] File "/var/lang/lib/python3.7/ssl.py", line 518, in options
[1571927898414] super(SSLContext, SSLContext).options.__set__(self, value)
[1571927898414] File "/var/lang/lib/python3.7/ssl.py", line 518, in options
[1571927898414] super(SSLContext, SSLContext).options.__set__(self, value)
[1571927898414] [Previous line repeated 477 more times]
[1571927898414] RecursionError: maximum recursion depth exceeded while calling a Python object

but, If I run the same line of code without zappa It is working fine.

Please help on this

like image 613
MeghP Avatar asked Feb 28 '26 07:02

MeghP


1 Answers

I had installed gevent and that was causing the error .After uninstalling gevent ,it is working well

like image 119
MeghP Avatar answered Mar 01 '26 21:03

MeghP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!