mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-12 00:43:31 -05:00
SyntaxError: Unexpected token 'd', "data: {"id"... is not valid JSON #3697
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Thinker-Joe on GitHub (Feb 8, 2025).
Bug Report
Installation Method
Docker
Environment
Confirmation:
Expected Behavior:
The API should return a valid JSON response without causing a syntax error.
Actual Behavior:
A
SyntaxErroroccurs in the browser console when processing the response. The error message is:The response appears to contain improperly formatted JSON data.
Description
Bug Summary:
When making a request to the
completionsAPI endpoint, the response data is not in valid JSON format. This causes the application to throw aSyntaxError.Reproduction Details
Steps to Reproduce:
completionsendpoint.completionsAPI call.Logs and Screenshots
Browser Console Logs:
Docker Container Logs:
Screenshots/Screen Recordings (if applicable):
[Attached screenshot for reference.]
Additional Information
The issue seems related to how the EventStream API responses are being handled. Specifically, the
data: {}format is not parsed correctly as JSON.Note
If further logs or testing are needed, I am happy to assist. Please let me know if additional details are required.
@Thinker-Joe commented on GitHub (Feb 8, 2025):
The issue has been solved, websocket support needs to be enabled
@FlechazoPh commented on GitHub (Feb 10, 2025):
Where is the websocket support setting ? chrome client or my server?
@enterusernamecontinue commented on GitHub (Feb 10, 2025):
创建反向代理时,启用 WebSocket 支持。
@micjac99 commented on GitHub (Feb 10, 2025):
the same issue . perfectly solved!!!!!!
@FlechazoPh commented on GitHub (Feb 11, 2025):
Solved, thanks~
@caoshiny commented on GitHub (Feb 13, 2025):
@CVYang commented on GitHub (Feb 13, 2025):
in company, websocket is banned by waf. any other method to solve this problem? does websocket used by openwebui or ollama???
@JokerQyou commented on GitHub (Feb 19, 2025):
However, if websocket connection is not established (e.g. WS connection blocked by WAF or load balancer), the API request to
/api/chat/completionsis still an SSE request, and it outputs event stream, can't the frontend just continue to use this stream like it did before? Right now it seems to drop this source. The syntax error is likely that SSE events are not correctly parsed: each stream has adata:prefix (according to SSE standard), so SSE events need an additional stripping compared to WS events.@overnightover commented on GitHub (Feb 20, 2025):
这个设置界面在哪plz
@overnightover commented on GitHub (Feb 20, 2025):
打扰了,在反向代理中找到设置了
@yuboqi commented on GitHub (Feb 21, 2025):
Has this problem been solved?
@JokerQyou commented on GitHub (Feb 21, 2025):
I don't think so. Correctly reverse-proxying websocket connections and you won't hit this issue. If you happen to use Cloudflare Tunnels (
cloudflaredwith ZeroTrust dashboard config) then this issue would persist.@voznik commented on GitHub (Feb 23, 2025):
I have this issue without any proxy, on local Linux machine, running openwebui with docker & local ollama service, with --host mode and with "Manage Ollama API Connections" setting set to http://127.0.0.1:11434
I don't understand how "proxy" answer could be applicable
@Thinker-Joe commented on GitHub (Feb 24, 2025):
However, it should be noted that:
These are extremely poor practices that significantly undermine Open WebUI's usability and brand value.
@JokerQyou commented on GitHub (Feb 24, 2025):
I know. It's not documented anywhere but in changelog of v0.5.0:
I'm not a developer of OpenWebUI. And as I pointed out in an earlier comment, OpenWebUI should continue to support SSE alongside websocket.
@Thinker-Joe commented on GitHub (Feb 24, 2025):
The problem occurs in the connection between your browser and the Open WebUI backend server. You need to check all network nodes in your path to accessing Open WebUI, rather than the Ollama API (which is unrelated to this problem).
The core point is that Open WebUI's API Server now requires WebSocket support. If you have any reverse proxies, load balancers, WAF (Web Application Firewall), or similar services in front of your Open WebUI service, you need to verify that they support WebSocket and have WebSocket support enabled.
@Thinker-Joe commented on GitHub (Feb 24, 2025):
Yep, many thanks you for your research, just hope our discussion can attract the attention of developers.
@sumitchatterjee13 commented on GitHub (Apr 6, 2025):
I am getting same error just after updating today. I don't know much about WebSocket and how to fix this issue.
@sunshibao commented on GitHub (Apr 18, 2025):
在Nginx 配置里添加
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";