Skip to content

fix: use VITE_BASE_URL instead of undefined VITE_API_URL (#434) - #436

Open
RounakKumarAgarwal wants to merge 1 commit into
AOSSIE-Org:mainfrom
RounakKumarAgarwal:fix/vite-api-url-undefined
Open

fix: use VITE_BASE_URL instead of undefined VITE_API_URL (#434)#436
RounakKumarAgarwal wants to merge 1 commit into
AOSSIE-Org:mainfrom
RounakKumarAgarwal:fix/vite-api-url-undefined

Conversation

@RounakKumarAgarwal

@RounakKumarAgarwal RounakKumarAgarwal commented Aug 31, 2026

Copy link
Copy Markdown

VITE_API_URL was referenced in teamService, notificationService, useDebateWS, and ViewDebate but is never defined in .env.example. Only VITE_BASE_URL is documented, so these flows fell back to localhost in production. Switch all four to VITE_BASE_URL.

Addressed Issues:

Fixes #434

Screenshots/Recordings:

Config-only change with no UI effect; behaviour is identical in local dev. Happy to attach a screen recording of the affected pages if useful.

Additional Notes:

VITE_API_URL is referenced in four files but is never defined in .env.example — only VITE_BASE_URL is documented. In any real deployment VITE_API_URL is undefined, so these flows fell back to localhost:1313 (or, for the WebSocket files, the frontend's own host), breaking team features, notifications, and the spectator/view-debate WebSocket in production. All four now use the documented VITE_BASE_URL. No behavioural change in local dev (the localhost fallback still applies).

Note: npm run build currently fails on main due to pre-existing TypeScript errors in unrelated files (CommentTree.tsx, Game.tsx, Profile.tsx, TeamDebateRoom.tsx, teamDebateService.ts). Those are present before and after this change — this PR neither introduces nor resolves them.

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Claude (Anthropic)

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Bug Fixes
    • Updated frontend API and WebSocket connections to use the standardized base URL configuration.
    • Improved consistency for debate rooms, notifications, and team-related requests.
    • Preserved the existing local fallback and URL handling behavior.

)

VITE_API_URL was referenced in teamService, notificationService,
useDebateWS, and ViewDebate but is never defined in .env.example.
Only VITE_BASE_URL is documented, so these flows fell back to
localhost in production. Switch all four to VITE_BASE_URL.

Fixes AOSSIE-Org#434
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b5ee0ba-f8ca-4ad5-8679-c280e84d12ef

📥 Commits

Reviewing files that changed from the base of the PR and between 7594019 and 80e0287.

📒 Files selected for processing (4)
  • frontend/src/Pages/ViewDebate.tsx
  • frontend/src/hooks/useDebateWS.ts
  • frontend/src/services/notificationService.ts
  • frontend/src/services/teamService.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The frontend now uses VITE_BASE_URL for team, notification, debate WebSocket, and spectator WebSocket connections. Existing fallback and URL normalization logic remain unchanged.

Changes

Frontend URL alignment

Layer / File(s) Summary
Update API and WebSocket URL consumers
frontend/src/services/notificationService.ts, frontend/src/services/teamService.ts, frontend/src/hooks/useDebateWS.ts, frontend/src/Pages/ViewDebate.tsx
The affected services and WebSocket connections now read VITE_BASE_URL instead of VITE_API_URL. Existing fallback and host derivation logic remain unchanged.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 80e02

The frontend now uses the documented backend URL for team, notification, debate, and spectator flows, restoring production routing without changing endpoints or authentication behavior. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary fix: replacing undefined VITE_API_URL with VITE_BASE_URL. It is concise and specific.
Linked Issues check ✅ Passed The changes satisfy issue #434. All four affected files now use VITE_BASE_URL, which prevents production localhost fallbacks and directs spectator WebSocket connections to the backend.
Out of Scope Changes check ✅ Passed The changes are limited to the four files and environment-variable replacements identified in issue #434. No unrelated code changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4 files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: VITE_API_URL is never defined in .env.example — team, notification & spectator-WS features break in production

1 participant