[GH-ISSUE #1111] bug: Model connection to api.openai.com timeout blocks page load #51008

Closed
opened 2026-05-05 11:44:42 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @ghost on GitHub (Mar 9, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/1111

Bug Report

Description

Bug Summary:

  1. Model connection to api.openai.com timeout blocks page load in Chromium for 5 minutes.

Steps to Reproduce:
Block outbound network access to api.openai.com.

Expected Behavior:
Connections shouldn't be made to openai.com if OPENAI_API_KEYS is unset or empty; perhaps this should also be an async call?

Actual Behavior:
Upon login, the page doesn't load for 5.2 minutes as demonstrated in the screenshot.

Environment

  • Operating System: Arch Linux
  • Browser (if applicable): Version 122.0.6261.111 (Official Build) Arch Linux (64-bit)

Reproduction Details

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs and Screenshots

Browser Console Logs:
Stack:

window.fetch @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1
u @ http://localhost:3000/_app/immutable/chunks/index.4a467a85.js:1
y @ http://localhost:3000/_app/immutable/nodes/2.cd1c2604.js:53
(anonymous) @ http://localhost:3000/_app/immutable/nodes/2.cd1c2604.js:53
z @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1
(anonymous) @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4
rt @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1
it @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1
_t @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4
(anonymous) @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4
(anonymous) @ http://localhost:3000/_app/immutable/nodes/0.7812a88a.js:1
z @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1
(anonymous) @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4
rt @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1
St @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4
ue @ http://localhost:3000/_app/immutable/entry/app.6f483be7.js:1
Pe @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1
ce @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1
re @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1
goto @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1
Nt @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:3
(anonymous) @ http://localhost:3000/:48
(anonymous) @ http://localhost:3000/:47

Docker Container Logs:

Mar 08 21:57:17 hostname open-webui[623336]: INFO:     10.0.2.100:57002 - "GET /api/v1/auths/ HTTP/1.1" 200 OK
Mar 08 21:57:17 hostname open-webui[623336]: get_all_models
Mar 08 21:57:17 hostname open-webui[623336]: INFO:     10.0.2.100:57002 - "GET /ollama/api/tags HTTP/1.1" 200 OK
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: get_all_models
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused]
Mar 08 22:02:29 hostname open-webui[623336]: INFO:     10.0.2.100:57002 - "GET /openai/api/models HTTP/1.1" 200 OK

Screenshots (if applicable):
image

Installation Method

Podman systemd service using docker image.

Additional Information

I've no interest in using OpenAI nor permitting Open WebUI unnecessary network access.

Originally created by @ghost on GitHub (Mar 9, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/1111 # Bug Report ## Description **Bug Summary:** 1. Model connection to api.openai.com timeout blocks page load in Chromium for 5 minutes. **Steps to Reproduce:** Block outbound network access to api.openai.com. **Expected Behavior:** Connections shouldn't be made to openai.com if OPENAI_API_KEYS is unset or empty; perhaps this should also be an async call? **Actual Behavior:** Upon login, the page doesn't load for 5.2 minutes as demonstrated in the screenshot. ## Environment - **Operating System:** Arch Linux - **Browser (if applicable):** Version 122.0.6261.111 (Official Build) Arch Linux (64-bit) ## Reproduction Details **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. ## Logs and Screenshots **Browser Console Logs:** Stack: ``` window.fetch @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1 u @ http://localhost:3000/_app/immutable/chunks/index.4a467a85.js:1 y @ http://localhost:3000/_app/immutable/nodes/2.cd1c2604.js:53 (anonymous) @ http://localhost:3000/_app/immutable/nodes/2.cd1c2604.js:53 z @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1 (anonymous) @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4 rt @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1 it @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1 _t @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4 (anonymous) @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4 (anonymous) @ http://localhost:3000/_app/immutable/nodes/0.7812a88a.js:1 z @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1 (anonymous) @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4 rt @ http://localhost:3000/_app/immutable/chunks/scheduler.67abc04a.js:1 St @ http://localhost:3000/_app/immutable/chunks/index.89481181.js:4 ue @ http://localhost:3000/_app/immutable/entry/app.6f483be7.js:1 Pe @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1 ce @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1 re @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1 goto @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:1 Nt @ http://localhost:3000/_app/immutable/entry/start.e3ef81c5.js:3 (anonymous) @ http://localhost:3000/:48 (anonymous) @ http://localhost:3000/:47 ``` **Docker Container Logs:** ``` Mar 08 21:57:17 hostname open-webui[623336]: INFO: 10.0.2.100:57002 - "GET /api/v1/auths/ HTTP/1.1" 200 OK Mar 08 21:57:17 hostname open-webui[623336]: get_all_models Mar 08 21:57:17 hostname open-webui[623336]: INFO: 10.0.2.100:57002 - "GET /ollama/api/tags HTTP/1.1" 200 OK Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: get_all_models Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: Connection error: Cannot connect to host api.openai.com:443 ssl:default [Connection refused] Mar 08 22:02:29 hostname open-webui[623336]: INFO: 10.0.2.100:57002 - "GET /openai/api/models HTTP/1.1" 200 OK ``` **Screenshots (if applicable):** ![image](https://github.com/open-webui/open-webui/assets/126992880/55f9b663-cfec-410a-9b19-f945d82f0b9a) ## Installation Method Podman systemd service using docker image. ## Additional Information I've no interest in using OpenAI nor permitting Open WebUI unnecessary network access.
Author
Owner

@justinh-rahb commented on GitHub (Mar 9, 2024):

Set your key to "None", try again.

<!-- gh-comment-id:1986855022 --> @justinh-rahb commented on GitHub (Mar 9, 2024): Set your key to "None", try again.
Author
Owner

@ghost commented on GitHub (Mar 11, 2024):

Set your key to "None", try again.

No change with --env OPENAI_API_KEY=None. Any value set for this variable doesn't seem to matter. Note that /backend/config.py already sets none when the the value is "" (although lower case):
8ed5759d0e/backend/config.py (L237-L238)

The default for OPENAI_API_BASE_URL is here:
8ed5759d0e/backend/config.py (L240-L241)

The only way I can get the main post-login page to load in a timely fashion is to set an invalid hostname like --env OPENAI_API_BASE_URL=None which results in this behavior:

Mar 10 18:24:19.764435 hostname open-webui[225839]: get_all_models
Mar 10 18:24:19.764437 hostname open-webui[225839]: INFO:     10.0.2.100:38726 - "GET /ollama/api/tags HTTP/1.1" 200 OK
Mar 10 18:24:19.769137 hostname open-webui[225839]: INFO:     10.0.2.100:38726 - "GET /api/v1/chats/ HTTP/1.1" 200 OK
Mar 10 18:24:19.769782 hostname open-webui[225839]: INFO:     10.0.2.100:38742 - "GET /api/changelog HTTP/1.1" 200 OK
Mar 10 18:24:19.784148 hostname open-webui[225839]: get_all_models
Mar 10 18:24:19.784158 hostname open-webui[225839]: Connection error: None/models
Mar 10 18:24:19.784161 hostname open-webui[225839]: get_all_models
Mar 10 18:24:19.784166 hostname open-webui[225839]: Connection error: None/models
Mar 10 18:24:19.784167 hostname open-webui[225839]: INFO:     10.0.2.100:38742 - "GET /openai/api/models HTTP/1.1" 200 OK

Here's what appears to be occuring:

  1. /backend/main.py mounts /openai/api: 8ed5759d0e/backend/main.py (L108)
  2. /routes/(app)/+layout.svelte executes onMount() which contains a call to getModels() at: 8ed5759d0e/src/routes/(app)/%2Blayout.svelte#L109
  3. The getModels() function then executes a request to the backend API getOpenAIModels(): 8ed5759d0e/src/routes/(app)/%2Blayout.svelte#L47-L68
  4. This results in a call to either get_models() or get_all_models() or both: 8ed5759d0e/backend/apps/openai/main.py (L171-L186) 8ed5759d0e/backend/apps/openai/main.py (L192-L222)
<!-- gh-comment-id:1987485736 --> @ghost commented on GitHub (Mar 11, 2024): > Set your key to "None", try again. No change with `--env OPENAI_API_KEY=None`. Any value set for this variable doesn't seem to matter. Note that _/backend/config.py_ already sets `none` when the the value is `""` (although lower case): https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/backend/config.py#L237-L238 The default for `OPENAI_API_BASE_URL` is here: https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/backend/config.py#L240-L241 The only way I can get the main post-login page to load in a timely fashion is to set an invalid hostname like `--env OPENAI_API_BASE_URL=None` which results in this behavior: ``` Mar 10 18:24:19.764435 hostname open-webui[225839]: get_all_models Mar 10 18:24:19.764437 hostname open-webui[225839]: INFO: 10.0.2.100:38726 - "GET /ollama/api/tags HTTP/1.1" 200 OK Mar 10 18:24:19.769137 hostname open-webui[225839]: INFO: 10.0.2.100:38726 - "GET /api/v1/chats/ HTTP/1.1" 200 OK Mar 10 18:24:19.769782 hostname open-webui[225839]: INFO: 10.0.2.100:38742 - "GET /api/changelog HTTP/1.1" 200 OK Mar 10 18:24:19.784148 hostname open-webui[225839]: get_all_models Mar 10 18:24:19.784158 hostname open-webui[225839]: Connection error: None/models Mar 10 18:24:19.784161 hostname open-webui[225839]: get_all_models Mar 10 18:24:19.784166 hostname open-webui[225839]: Connection error: None/models Mar 10 18:24:19.784167 hostname open-webui[225839]: INFO: 10.0.2.100:38742 - "GET /openai/api/models HTTP/1.1" 200 OK ``` Here's what appears to be occuring: 1. _/backend/main.py_ mounts **/openai/api**: https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/backend/main.py#L108 2. _/routes/(app)/+layout.svelte_ executes `onMount()` which contains a call to `getModels()` at: https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/src/routes/(app)/%2Blayout.svelte#L109 3. The `getModels()` function then executes a request to the backend API `getOpenAIModels()`: https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/src/routes/(app)/%2Blayout.svelte#L47-L68 4. This results in a call to either `get_models()` or `get_all_models()` or both: https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/backend/apps/openai/main.py#L171-L186 https://github.com/open-webui/open-webui/blob/8ed5759d0e9424f87d01fe3f8013116c4ba2004f/backend/apps/openai/main.py#L192-L222
Author
Owner

@tjbck commented on GitHub (Mar 11, 2024):

Just added a fix to our 'dev' branch, let me know if the issue persists!

<!-- gh-comment-id:1987498410 --> @tjbck commented on GitHub (Mar 11, 2024): Just added a fix to our 'dev' branch, let me know if the issue persists!
Author
Owner

@ghost commented on GitHub (Mar 11, 2024):

Thank you very much, fix confirmed.

<!-- gh-comment-id:1987539907 --> @ghost commented on GitHub (Mar 11, 2024): Thank you very much, fix confirmed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#51008