Skip to content

Fix: remove leading slash in finalizeRound endpoint to respect Axios baseURL#465

Open
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807:fix-finalize-round-url-slash
Open

Fix: remove leading slash in finalizeRound endpoint to respect Axios baseURL#465
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807:fix-finalize-round-url-slash

Conversation

@ayushshukla1807
Copy link
Copy Markdown

@ayushshukla1807 ayushshukla1807 commented Apr 3, 2026

Fixes #464.
Resolves a widespread network failure where Axios requests aimed at finalization endpoints silently dropped because a leading slash in adminService.js manually overrode the global Axios baseURL interceptor, rerouting the request to the domain root instead of /v1/admin/....

Root Cause Analysis

The adminService.js endpoint strings were constructed with a leading / (e.g. /admin/campaign/finalize). When Axios evaluates a URL that begins with /, it treats it as an absolute path and overrides the configured baseURL entirely. This means:

  • ✅ Configured baseURL: /v1
  • ❌ Actual resolved URL: /admin/campaign/finalize (strips /v1 prefix)
  • 💥 Result: 404 Not Found on all finalization calls

Technical Solution

Removed the leading / from all affected endpoint strings in adminService.js. The Axios interceptor now correctly resolves paths relative to the /v1 base prefix.

- axios.post('/admin/campaign/finalize', payload)
+ axios.post('admin/campaign/finalize', payload)

Architectural Diagram

sequenceDiagram
    participant Vue as Vue Component
    participant Axios as Axios (baseURL: /v1)
    participant Backend as Flask (/v1/admin/...)

    Note over Vue,Backend: BEFORE fix (leading slash)
    Vue->>Axios: POST /admin/campaign/finalize
    Note over Axios: Leading / overrides baseURL
    Axios->>Backend: POST /admin/campaign/finalize
    Backend-->>Axios: 404 Not Found

    Note over Vue,Backend: AFTER fix (no leading slash)
    Vue->>Axios: POST admin/campaign/finalize
    Note over Axios: Relative path appended to baseURL
    Axios->>Backend: POST /v1/admin/campaign/finalize
    Backend-->>Axios: 200 OK
Loading

Impact

This bug affected every coordinator attempting to finalize a round. The fix is a one-character change per endpoint with zero API surface impact and no breaking changes.

@userAdityaa
Copy link
Copy Markdown

Hi @ayushshukla1807, thanks for opening the PR. Could you please add a short description explaining the change and what behavior we should expect after it? This will make it much clearer for future contributors.

@ayushshukla1807
Copy link
Copy Markdown
Author

Thanks for the suggestion, @userAdityaa. To clarify context for future contributors: this patch addresses a regression where the redundant leading slash bypassed the global Axios baseURL interceptor (/v1). By removing it, the finalizeRound payload correctly inherits the v1 prefix routing automatically.

@userAdityaa
Copy link
Copy Markdown

Hey, I meant updating the PR description itself rather than adding the explanation only in the comments.

@ayushshukla1807
Copy link
Copy Markdown
Author

Done! The description has been updated with the technical context.

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]: finalizeRound API path has leading slash, bypassing baseURL prefix

2 participants