dify icon indicating copy to clipboard operation
dify copied to clipboard

Validation error in HttpRequestNodeData in production

Open nfaganelly opened this issue 2 years ago • 11 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [X] Please do not modify this template :) and fill in all the required fields.

Dify version

last

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Create a workflow that uses the HttpRequestNodeData module.
  2. Configure the HTTP request body with data in string format.
  3. Run the workflow in the test environment (it works normally).
  4. Run the same workflow in the production environment.
  5. Observe the error generated.
{
  "nome": "{{#17246...2038442.guests#}}"
}

✔️ Expected Behavior

The workflow should work correctly in production, just as it does in the test environment, without generating validation errors.

❌ Actual Behavior

In production, the workflow generates the following validation error:

1 validation error for HttpRequestNodeData
body.data 'str' instances are not allowed as a Sequence value [type=sequence_str, input_value='{\n "nome": "{{#17246...2038442.guests#}}"\n }', input_type=str]

nfaganelly avatar Oct 21 '24 13:10 nfaganelly

Hello @nfaganelly! I'm here to help you with any bugs, questions, or contributions you may have. Let's tackle this issue together!

The validation error you're encountering in the production environment is due to the body.data field being expected as a Sequence[BodyData], but it seems to be receiving a string instead. In the Dify platform, the body.data field should be structured according to the type of HTTP request body you are using.

Here's how you can structure the body.data field correctly:

  1. For BodyType.formData and BodyType.xWwwFormUrlencoded:

    • body.data should be an array of objects, each with id, type, key, and value fields.
  2. For BodyType.rawText and BodyType.json:

    • body.data should be an array with at least one object, where the first object has id, type, key (empty), and value (the raw text or JSON string).
  3. For BodyType.binary:

    • body.data should be an array with at least one object, where the first object has id, type, and file fields.

Ensure that the body.data field in your production environment is structured as a sequence of objects rather than a single string. This should resolve the validation error you're experiencing [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Oct 21 '24 13:10 dosubot[bot]

image

No requests have been changed, I have been using it normally for 2 weeks, after the v0.10.0 update it started generating this error and only in production, in testing it runs normally.

nfaganelly avatar Oct 21 '24 13:10 nfaganelly

I'm going through this same problem. I deleted it and redid it, I think it was a cache problem.

74sistemas avatar Oct 21 '24 13:10 74sistemas

image After the update, the error appeared, in the other tools I deleted it and did it again and kept updating until I got it right, see the last one the problem continues so I must delete the tool and do it again while updating... that's why I think it could be a chache something like that

74sistemas avatar Oct 21 '24 15:10 74sistemas

image See, I deleted the json provided and saved the tool. I went back and inserted the json and the error in the chatbot disappeared and the flow returned normally.

74sistemas avatar Oct 21 '24 15:10 74sistemas

Sorry, we encountered a small issue with historical data migration.

  1. For users who are using Docker for self-deployment, you can wait for the next version or delete and rebuild the node.
  2. For users who are using source code deployment, you can pull the latest code from the main branch, which should work.
  3. For Cloud users. Please try again.

If the above responses solve your issue, please let me know (along with the deployment method you are using).

laipz8200 avatar Oct 21 '24 15:10 laipz8200

A workflow that was working stopped working for me too.

Now I'm getting this error when passing a number parameter in the body of the JSON request:

image

IvanHenrique avatar Oct 22 '24 00:10 IvanHenrique

A workflow that was working stopped working for me too.

Now I'm getting this error when passing a number parameter in the body of the JSON request:

image

I opened a new issue about this problem here:

https://github.com/langgenius/dify/issues/9590

IvanHenrique avatar Oct 22 '24 01:10 IvanHenrique

Hi @IvanHenrique I'm facing the same issue as you are.

"tool invoke error: 1 validation error for HttpRequestNodeData\nbody.data\n 'str' instances are not allowed as a Sequence value [type=sequence_str, input_value='', input_type=str]"}

Did find any solution for that?

Thank you

valneimelo avatar Oct 22 '24 03:10 valneimelo

I have a same issue. I deployed them in kubernetes, and version is 0.10.0.

Could you share a solution?

jiusi9 avatar Oct 23 '24 07:10 jiusi9

Here, I duplicated and deleted the old one, then it worked again.

nfaganelly avatar Oct 23 '24 14:10 nfaganelly