langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
48.98k stars 7.01k forks source link

HTTP Request Node JSON body error #9696

Closed qkxie closed 2 hours ago

qkxie commented 3 hours ago

Self Checks

Dify version

0.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. create a http request node
  2. set request method to post, and set body to json
  3. make a request

✔️ Expected Behavior

get the response

❌ Actual Behavior

http request node change my json body. the field of top_k should be 8, but in the log, it becomes to null, so the request failed.

image image

dosubot[bot] commented 3 hours ago

I found two similar discussions regarding issues with the HTTP request node losing JSON request data:

  1. The HTTP-request node loses JSON request data after I saved it, last updated on May 8, 2024.
  2. HTTP request node 填写了 body,保存完后,还是 none 选项,填写的json丢失!!!, last updated on May 6, 2024.

These discussions are still open and unsolved, which might indicate a related issue with how JSON bodies are handled in the HTTP request node.

Regarding your specific issue, it seems that the top_k field in your JSON body is unexpectedly set to null, which causes the request to fail. This could be due to a bug in the handling of JSON bodies in the HTTP request node. There is an error handling mechanism in place that logs warnings if exceptions occur during the execution of the HTTP request node, which might help in diagnosing the issue [1].

If you haven't already, you might want to check the logs for any warnings or errors that could provide more insight into why the top_k field is being set to null. Additionally, ensure that the JSON body is correctly formatted and that all variables are properly defined and accessible in the context of the request.

To continue talking to Dosu, mention @dosu.

qkxie commented 3 hours ago

You can reproduce this bug by just simply set url to https://xxx.com/a, and set body to

{
"test1": true,
"test2": 5
}

just like below: image image

laipz8200 commented 2 hours ago

I think it should be fixed in the main branch by #9616

image
qkxie commented 2 hours ago

As I use docker-compose to launch Dify, should I build a docker image by myself and replace the image url in docker compose yaml? When will you release a new version which include the patch? @laipz8200

crazywoola commented 2 hours ago

image @qkxie