Skip to content

fix: prefer INTERNAL_APP_URL for ComfyUI server calls#15387

Merged
arvinxx merged 1 commit into
lobehub:canaryfrom
xujingli:codex-comfyui-internal-app-url
Jun 4, 2026
Merged

fix: prefer INTERNAL_APP_URL for ComfyUI server calls#15387
arvinxx merged 1 commit into
lobehub:canaryfrom
xujingli:codex-comfyui-internal-app-url

Conversation

@xujingli

@xujingli xujingli commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

Fixes #15328

🔀 Description of Change

This PR makes LobeComfyUI.createImage() prefer INTERNAL_APP_URL when calling the internal /webapi/create-image/comfyui endpoint.

This keeps the existing fallback order intact for deployments that do not configure INTERNAL_APP_URL:

  1. INTERNAL_APP_URL
  2. APP_URL
  3. Vercel URL
  4. local PORT fallback

This helps self-hosted reverse-proxy deployments route server-to-server ComfyUI calls through an internal URL instead of the public URL protected by auth/CDN/proxy layers.

🧪 How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed
pnpm exec vitest run --silent='passed-only' src/providers/comfyui/__tests__/index.test.ts

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@xujingli is attempting to deploy a commit to the LobeHub OSS Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 1, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @xujingli, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f0274786e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const isInVercel = process.env.VERCEL === '1';
const vercelUrl = `https://${process.env.VERCEL_URL}`;
const appUrl =
process.env.INTERNAL_APP_URL ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize INTERNAL_APP_URL before appending the path

When INTERNAL_APP_URL is configured with a trailing slash, this concatenation sends the request to //webapi/create-image/comfyui instead of /webapi/create-image/comfyui. Unlike the async server caller, which uses urlJoin and explicitly tests trailing-slash normalization, this path can miss the Next route or rely on a redirect for the POST, so deployments that set INTERNAL_APP_URL=http://localhost:3210/ can still fail ComfyUI generation despite configuring the new internal URL.

Useful? React with 👍 / 👎.

@lobehubbot

Copy link
Copy Markdown
Member

@tjx666 - This is a model provider (ComfyUI image generation) fix. Please take a look.

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.85%. Comparing base (bab3ff4) to head (a0f4de8).
⚠️ Report is 4 commits behind head on canary.

Additional details and impacted files
@@             Coverage Diff             @@
##           canary   #15387       +/-   ##
===========================================
- Coverage   89.22%   70.85%   -18.37%     
===========================================
  Files         892     3255     +2363     
  Lines      108146   321010   +212864     
  Branches    10604    29331    +18727     
===========================================
+ Hits        96490   227457   +130967     
- Misses      11474    93371    +81897     
  Partials      182      182               
Flag Coverage Δ
app 61.52% <ø> (?)
database 92.54% <ø> (ø)
packages/agent-manager-runtime 49.69% <ø> (ø)
packages/agent-runtime 80.48% <ø> (ø)
packages/builtin-tool-lobe-agent 18.52% <ø> (ø)
packages/context-engine 84.19% <ø> (ø)
packages/conversation-flow 91.29% <ø> (ø)
packages/device-gateway-client 89.68% <ø> (ø)
packages/eval-dataset-parser 95.15% <ø> (ø)
packages/eval-rubric 76.11% <ø> (ø)
packages/fetch-sse 87.28% <ø> (ø)
packages/file-loaders 87.89% <ø> (ø)
packages/memory-user-memory 74.99% <ø> (ø)
packages/model-bank 99.99% <ø> (ø)
packages/model-runtime 84.51% <100.00%> (+<0.01%) ⬆️
packages/prompts 72.51% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/types 35.34% <ø> (ø)
packages/utils 84.98% <ø> (ø)
packages/web-crawler 88.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 68.53% <ø> (∅)
Services 54.75% <ø> (∅)
Server 71.85% <77.50%> (∅)
Libs 57.01% <ø> (∅)
Utils 81.48% <ø> (-18.52%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx force-pushed the codex-comfyui-internal-app-url branch from 3f02747 to b51380b Compare June 4, 2026 09:01
@arvinxx arvinxx force-pushed the codex-comfyui-internal-app-url branch from b51380b to a0f4de8 Compare June 4, 2026 10:25
@arvinxx arvinxx merged commit 92ec067 into lobehub:canary Jun 4, 2026
20 of 22 checks passed
@lobehubbot

Copy link
Copy Markdown
Member

❤️ Great PR @xujingli ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] Support INTERNAL_APP_URL in LobeComfyUI.createImage() for reverse-proxy deployments

3 participants