Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session_id parameter in payload causes "Response 504" error in DataStax Langflow (11/6/24) #4434

Open
SonicDMG opened this issue Nov 6, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@SonicDMG
Copy link
Collaborator

SonicDMG commented Nov 6, 2024

Bug Description

Adding "session_id" parameter to the payload when using the Python SDK causes an error on DS Langflow.
This works great using a local version of Langflow at version 1.0.19.post2.

Here is both a error trace along with a working trace. I printed out the payload, headers, and response for troubleshooting:

Broken

You: test me
API URL: https://api.langflow.astra.datastax.com/lf/37fb0878-2f37-4245-b1c9-bfb7b47b5036/api/v1/run/zoom_ai_bot
PAYLOAD: {'input_value': 'test me', 'output_type': 'chat', 'input_type': 'chat', 'session_id': 'local_zoom_ai_bot_user'}
HEADERS: {'Authorization': 'Bearer AstraCS:somethigyoushouldnotsee', 'Content-Type': 'application/json'}
JSON RESPONSE: <Response [504]>
Traceback (most recent call last):
File "/Users/david.gilardi/zmail_astradb/venv/lib/python3.11/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david.gilardi/.pyenv/versions/3.11.9/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david.gilardi/.pyenv/versions/3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david.gilardi/.pyenv/versions/3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/david.gilardi/zmail_astradb/datastax/zoom_ai_bot.py", line 160, in
main()
File "/Users/david.gilardi/zmail_astradb/datastax/zoom_ai_bot.py", line 156, in main
response = get_response_from_api(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david.gilardi/zmail_astradb/datastax/zoom_ai_bot.py", line 128, in get_response_from_api
result = run_flow(
^^^^^^^^^
File "/Users/david.gilardi/zmail_astradb/datastax/zoom_ai_bot.py", line 86, in run_flow
return response.json()
^^^^^^^^^^^^^^^
File "/Users/david.gilardi/zmail_astradb/venv/lib/python3.11/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
python3 datastax/zoom_ai_bot.py
Welcome to the Zoom AI Bot. Type 'exit' to quit.

Working

You: test me
API URL: https://api.langflow.astra.datastax.com/lf/37fb0878-2f37-4245-b1c9-bfb7b47b5036/api/v1/run/zoom_ai_bot
PAYLOAD: {'input_value': 'test me', 'output_type': 'chat', 'input_type': 'chat'}
HEADERS: {'Authorization': 'Bearer AstraCS:somethingyoushouldnotsee', 'Content-Type': 'application/json'}
JSON RESPONSE: <Response [200]>
Bot: I did.

Reproduction

  1. Add session_id to payload using the Python SDK when using DS Langflow
  2. Execute code to execute flow

Notice the code below. If I comment out the session_id param below using a local LF instance at 1.0.19.post2 this works. It, however, will break DS Langflow.
If I comment session_id out the code works fine on DS Langflow.

payload = {
        "input_value": message,
        "output_type": output_type,
        "input_type": input_type,
        #"session_id": session_id
    }
    headers = None
    if tweaks:
        payload["tweaks"] = tweaks
    if application_token:
        headers = {"Authorization": "Bearer " + application_token, "Content-Type": "application/json"}
    response = requests.post(api_url, json=payload, headers=headers, timeout=30)

Expected behavior

The session_id value is passed along with the payload correctly setting the session_id value for affected components and, thereby, storing the correct user session ID value in our chat_history Astra DB collection.

Who can help?

No response

Operating System

DataStax Langflow

Langflow Version

1.0.19.post1???

Python Version

None

Screenshot

No response

Flow File

No response

@SonicDMG SonicDMG added the bug Something isn't working label Nov 6, 2024
@Ali-Traboulsi
Copy link

I am having the same issue when making a post request on this url:

https://api.langflow.astra.datastax.com/lf/1f52cc28-06aa-493e-a415-3ce9cf0dae8e/api/v1/run/macros

no matter what I do the error persists:

504 upstream request timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants