plaid/plaid-python

Fastapi is not able to convert create_link_token method return into jsonable object

akshaybhuradia29 opened this issue · 1 comments

Hi,

I am using python-plaid with fastapi.
Consuming library method like

_response = plaid_client.link_token_create(request, async_req=True)
result = _response.get()
return result

when ever i hit endpoint with above for create link token i get error :

File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 303, in jsonable_encoder
jsonable_encoder(
File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 333, in jsonable_encoder
return jsonable_encoder(
^^^^^^^^^^^^^^^^^
File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 289, in jsonable_encoder
encoded_value = jsonable_encoder(
^^^^^^^^^^^^^^^^^
File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 332, in jsonable_encoder
raise ValueError(errors) from e
ValueError: [TypeError("'_thread.RLock' object is not iterable"), TypeError('vars() argument must have dict attribute')]

This appears to be related to an incorrect calling pattern for async requests with FastAPI, without using await. See https://stackoverflow.com/questions/72611531/adding-async-to-fastapi-function-gives-me-the-coroutine-object-is-not-iterabl

Closing as this does not appear related to the Plaid API.