dify icon indicating copy to clipboard operation
dify copied to clipboard

405 METHOD NOT ALLOWED while calling /v1/chat-messages

Open Jinglever opened this issue 1 year ago • 1 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

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I call the api "/v1/chat-messages", and get response that is "405 METHOD NOT ALLOWED".

curl --location 'http://dify.xxx.com/v1/chat-messages'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer app-nFH9B8ikuh7wsJNlFcLGpzhp'
--data '{ "inputs": {}, "query": "What are the specs of the iPhone 13 Pro Max?", "conversation_id": "", "user": "abc-123sss" }'

The screenshots of postman:

Image

The screenshots of container "docker-api-1":

Image

✔️ Expected Behavior

Get the answer generated by chatbot.

❌ Actual Behavior

405 METHOD NOT ALLOWED

{ "code": "method_not_allowed", "message": "The method is not allowed for the requested URL.", "status": 405 }

Jinglever avatar Feb 20 '25 13:02 Jinglever

@Jinglever Hello there! I'm here to help you with any bugs, questions, or contributions. Let's figure this out together!

You are receiving a "405 METHOD NOT ALLOWED" error because you are using the incorrect API endpoint format for Dify version 0.15.3. The correct endpoint format is ${domain}/api/chat-messages, not /v1/chat-messages. Make sure to update your API call to use the correct endpoint format to resolve this issue [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Feb 20 '25 13:02 dosubot[bot]

turns out that is because I use http instead of https, after change to https, It work. Thanks.

Jinglever avatar Feb 20 '25 15:02 Jinglever