Skip to content

fix: guard EventSource when API_BASE_URL unset - #104

Merged
csecrestjr merged 1 commit into
codex/create-shared-api_base_url-constantfrom
codex/fix-comment-in-chatwindow.jsx
Sep 5, 2025
Merged

fix: guard EventSource when API_BASE_URL unset#104
csecrestjr merged 1 commit into
codex/create-shared-api_base_url-constantfrom
codex/fix-comment-in-chatwindow.jsx

Conversation

@csecrestjr

Copy link
Copy Markdown
Collaborator

Summary

  • fall back to window.location.origin when API_BASE_URL is absent

Testing

  • npm test

https://chatgpt.com/codex/tasks/task_e_68bb656927f8832182d62be9febcc3aa

@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 suggestions.

Reply with @codex fix comments to fix any unresolved comments.

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, or 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 fix this CI failure" or "@codex address that feedback".

Comment on lines +17 to +18
const base = API_BASE_URL || window.location.origin;
const url = new URL(`/stream/${state.currentConversation.id}`, base);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Preserve path prefixes when building EventSource URL

Building the URL via new URL('/stream/...', base) resets the path component of base when it contains a subpath. If VITE_API_BASE_URL is configured as https://example.com/api, the previous string concatenation produced https://example.com/api/stream/..., but the new implementation now resolves to https://example.com/stream/..., dropping the /api prefix and causing the SSE connection to hit the wrong endpoint. Construct the URL without stripping path segments (e.g. avoid the leading / or ensure the base already includes the trailing slash).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@codex fix comments

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Testing

  • npm test

View task →

@csecrestjr
csecrestjr merged commit 903e955 into codex/create-shared-api_base_url-constant Sep 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant