Skip to content

Issues when using jcapiv1.SystemusersApi(jcapiv1.ApiClient(configuration)) on AWS Lambda #50

@maneskiivan

Description

@maneskiivan

Hello,

I am able to use the script below successfully when deployed locally on my computer:

configuration = jcapiv1.Configuration() configuration.api_key['x-api-key'] = jumpcloud_apikey # create an instance of the API class api_instance = jcapiv1.SystemusersApi(jcapiv1.ApiClient(configuration)) content_type = 'application/json' # str | (default to application/json) accept = 'application/json' # str | (default to application/json) x_org_id = jumpcloud_org_id # str | (optional) (default to ) body = jcapiv1.Systemuserputpost( email='jdoe@email.com', username='jdoe', firstname='John', lastname='Doe' ) api_response = api_instance.systemusers_post(content_type, accept, body=body, x_org_id=x_org_id)

When I use the script on AWS Lambda I get the following error:

{
"errorMessage": "[Errno 38] Function not implemented",
"errorType": "OSError",
"stackTrace": [
" File "/var/task/lambda_function.py", line 17, in lambda_handler\n api_instance = jcapiv1.SystemusersApi(jcapiv1.ApiClient(configuration))\n",
" File "/opt/python/lib/python3.8/site-packages/jcapiv1/api_client.py", line 69, in init\n self.pool = ThreadPool()\n",
" File "/var/lang/lib/python3.8/multiprocessing/pool.py", line 925, in init\n Pool.init(self, processes, initializer, initargs)\n",
" File "/var/lang/lib/python3.8/multiprocessing/pool.py", line 196, in init\n self._change_notifier = self._ctx.SimpleQueue()\n",
" File "/var/lang/lib/python3.8/multiprocessing/context.py", line 113, in SimpleQueue\n return SimpleQueue(ctx=self.get_context())\n",
" File "/var/lang/lib/python3.8/multiprocessing/queues.py", line 336, in init\n self._rlock = ctx.Lock()\n",
" File "/var/lang/lib/python3.8/multiprocessing/context.py", line 68, in Lock\n return Lock(ctx=self.get_context())\n",
" File "/var/lang/lib/python3.8/multiprocessing/synchronize.py", line 162, in init\n SemLock.init(self, SEMAPHORE, 1, 1, ctx=ctx)\n",
" File "/var/lang/lib/python3.8/multiprocessing/synchronize.py", line 57, in init\n sl = self._semlock = _multiprocessing.SemLock(\n"
]
}

I found some article that suggest I should use the multiprocessing library to handle this issue. I tried resolving this with that library with no success.

Any help would be greatly appreciated.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions