langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
28.24k stars 3.65k forks source link

Flow works in Playground but fails when called from Webhook #3407

Closed Gluepower closed 1 week ago

Gluepower commented 3 weeks ago

Bug Description

Flow works great when run in playground. However, when called from HTTP POST Request from n8n it fails. n8n gives this message that is successful image

Reproduction

Untitled document (1).txt Log is too large to copy here so attaching as file.

Expected behavior

If flow can be executed in playground, why calling the same flow via HTTP post creates all these problems?

Who can help?

No response

Operating System

Render

Langflow Version

1.0.15

Python Version

3.12

Screenshot

No response

Flow File

No response

dosubot[bot] commented 3 weeks ago

The issue you're experiencing, where the flow works in the Playground but fails when called from an HTTP request, is likely due to improper handling of authentication tokens or cookies in the HTTP request.

In the provided HAR file, the HTTP requests include an Authorization header and a Cookie header with the access_token_lf token. If these tokens are not correctly managed or included in the HTTP request when calling the flow from Langflow, it could cause the flow to fail.

Ensure that the Authorization and Cookie headers are correctly set in your HTTP request. Here is an example of how the headers should be included:

{
  "method": "GET",
  "url": "http://localhost:3000/api/v1/users/whoami",
  "headers": {
    "Accept": "application/json, text/plain, */*",
    "Accept-Encoding": "gzip, deflate, br, zstd",
    "Accept-Language": "en-US,en;q=0.9",
    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwMzg5ZmIyOS1kYWE2LTQwOGMtYjhjYi1iOGZmOGQxNzM0M2EiLCJleHAiOjE3NDA2NjY3NTB9.ef5W5jwNOeVzU3JZ7ylLYf2MLEJcVxC4-fF7EK9Ecdc",
    "Connection": "keep-alive",
    "Cookie": "access_token_lf=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwMzg5ZmIyOS1kYWE2LTQwOGMtYjhjYi1iOGZmOGQxNzM0M2EiLCJleHAiOjE3NDA2NjY3NTB9.ef5W5jwNOeVzU3JZ7ylLYf2MLEJcVxC4-fF7EK9Ecdc",
    "Host": "localhost:3000",
    "Referer": "http://localhost:3000/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-origin",
    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
    "sec-ch-ua": "\"Chromium\";v=\"123\", \"Not:A-Brand\";v=\"8\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Linux\""
  }
}

Additionally, verify that the access_token_lf token is valid and not expired, as indicated by the set-cookie header in the HAR file, which shows the token being set with a specific expiration time [1][2].

To continue talking to Dosu, mention @dosu.

Gluepower commented 2 weeks ago

@anovazzi1 I figured from those logs that most of the errors are because I am using subflow. For some reason subflow is not executing correctly when flow is called from webhook. I tried to put everything into a single flow without any subflows, however there is one issue remaining. In other words, still not working. Subflow errors are gone as I am not using subflow , but this one with OpenAI secret string being null value is still here. I have updated to 1.0.16

image

anovazzi1 commented 1 week ago

hey @Gluepower, sorry for the delay, did you manage to fix that? can you provide the flow for local debugging? I think it's related to langchain dependencie version, but it's a initial guess. About the subflow we are working on fix it, but i would say to avoid use it in production rn

ogabrielluiz commented 1 week ago

This is related to the global variables. Planning on fixing this today.