Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/drizzle ./drizzle
COPY --from=builder /app/VERSION ./VERSION

# TODO: Switch to custom server entry for WebSocket support once ingress handler is ready
# CMD ["node", "src/server/index.js"]
CMD ["node", "server.js"]
Comment on lines +28 to 30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Dockerfile CMD =="
sed -n '28,30p' Dockerfile

echo
echo "== package.json scripts =="
node <<'NODE'
const pkg = require("./package.json");
console.log("start    =", pkg.scripts?.start);
console.log("start:ws =", pkg.scripts?.["start:ws"]);
NODE

echo
echo "== custom server entry =="
fd index.ts src/server -x sed -n '1,220p' {}

echo
echo "== runtime/build references =="
rg -n --glob '!node_modules' 'src/server/index|server\.js|/v1/responses|WebSocketServer|ws-manager' .

Repository: ding113/claude-code-hub

Length of output: 18518


Docker 当前运行的是 Next.js 独立输出,会跳过自定义 WS 服务器。

容器启动 server.js(Next.js standalone from .next/standalone/),而完整的 HTTP+WS 引导逻辑在 src/server/index.ts 中。该自定义服务器已正确实现:

  • 在同一端口附加 WebSocket 管理器
  • /v1/responses 路径配置完成
  • WsManager 和 WebSocketServer 依赖已导入

问题:Docker 目前运行的 standalone 输出不包含自定义服务器代码,导致容器内 WebSocket 无法工作。

修复:修改 Dockerfile 第 28-30 行,将 CMD ["node", "server.js"] 改为:

CMD ["node", "--import", "tsx", "src/server/index.ts"]

或更新构建流程,确保自定义服务器逻辑被编译进 server.js

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Dockerfile` around lines 28 - 30, The Dockerfile currently launches the
Next.js standalone server (CMD running server.js) which skips the custom HTTP+WS
bootstrap in src/server/index.ts; update the Dockerfile to run the custom server
entry instead (start node with tsx importing src/server/index.ts) or
alternatively change the build so that the compiled server.js includes the
custom server code from src/server/index.ts; ensure the container runs the entry
that initializes WsManager/WebSocketServer and mounts the /v1/responses route
rather than the standalone Next output.

2 changes: 2 additions & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ COPY --from=build --chown=node:node /app/.next/static ./.next/static
USER node
EXPOSE 3000

# TODO: Switch to custom server entry for WebSocket support once ingress handler is ready
# CMD ["node", "src/server/index.js"]
CMD ["node", "server.js"]
Comment on lines +61 to 63
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 检查 server.js 和 src/server/index.js 的存在及内容

# 查找服务器相关文件
echo "=== 查找服务器入口文件 ==="
fd -t f -e js -e ts "^(server|index)\.(js|ts)$" --max-depth 2

echo ""
echo "=== 检查 package.json 中的启动脚本 ==="
cat package.json | jq '.scripts | to_entries | map(select(.key | test("start")))' 2>/dev/null || grep -A 5 '"scripts"' package.json

Repository: ding113/claude-code-hub

Length of output: 259


🏁 Script executed:

#!/bin/bash
# 检查 Next.js 构建配置和服务器文件结构

echo "=== 查找 Next.js 配置文件 ==="
fd -t f "next\.config\.(js|ts|mjs)" .

echo ""
echo "=== 检查 src/server 目录结构 ==="
fd -t f . src/server/ 2>/dev/null || echo "src/server/ 目录不存在或为空"

echo ""
echo "=== 检查 .next 构建输出目录 ==="
ls -la .next/ 2>/dev/null | head -20 || echo ".next/ 目录不存在"

echo ""
echo "=== 查找所有 server 相关文件 ==="
fd -t f "server" . --exclude "node_modules" --exclude ".git" --exclude ".next"

echo ""
echo "=== 检查 Dockerfile 的完整内容 ==="
cat deploy/Dockerfile

Repository: ding113/claude-code-hub

Length of output: 2454


TODO 注释已过时,Dockerfile 应更新以使用自定义服务器入口。

WebSocket 入站处理器已在本 PR 中实现(src/server/index.tsws-manager.ts 存在),但 Dockerfile 仍在使用默认的 Next.js 服务器(server.js 来自 .next/standalone)。请将 CMD 更新为使用自定义服务器入口点 src/server/index.ts,或澄清为何目前仍使用默认服务器。

同时,注释中对 src/server/index.js 的引用不正确,实际文件为 src/server/index.ts

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy/Dockerfile` around lines 61 - 63, Update the Dockerfile CMD to run the
custom server entry used for WebSocket handling instead of the default Next.js
standalone server: replace the existing CMD that launches server.js with one
that starts your custom server entry (src/server/index.ts compiled/started
appropriately) and remove or correct the outdated TODO/comment that references
src/server/index.js; ensure the Docker runtime/start command aligns with how you
build and run TypeScript (e.g., use the compiled JS entry or a node wrapper) so
the custom entry that references ws-manager.ts is actually launched.

2 changes: 2 additions & 0 deletions deploy/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ COPY --from=build --chown=node:node /app/.next/static ./.next/static
USER node
EXPOSE 3000

# TODO: Switch to custom server entry for WebSocket support once ingress handler is ready
# CMD ["node", "src/server/index.js"]
CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions drizzle/0079_quick_blink.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "system_settings" ADD COLUMN "enable_responses_websocket" boolean DEFAULT false NOT NULL;
Loading
Loading