Skip to content

Conversation

andypols
Copy link
Contributor

Summary

This PR fixes a bug introduced in #1201 related to the URL API.

The URL constructor does not support relative paths. When process.env.VITE_API_URI is not defined, API_BASE falls back to a relative path. As a result, code like this throws an exception in certain environments:

const url = new URL(`${API_BASE}/api/auth/gitAccount`);

Fix

  • Remove the use of URL objects when building url string with ${API_BASE}.
    • URLs are now built as plain strings.
  • Cleaned up unused query param handling:
    • /api/v1/user does not pass any query params.
    • getUsers always passed an empty query params object.
    • No params are ever passed into UserList

Copy link

netlify bot commented Sep 26, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit c6e3635
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/68d6d88bbf3547000834ba72

@github-actions github-actions bot added the fix label Sep 26, 2025
@andypols andypols added bug Something isn't working and removed fix labels Sep 26, 2025
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.20%. Comparing base (db1debc) to head (c6e3635).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1228      +/-   ##
==========================================
+ Coverage   84.01%   84.20%   +0.18%     
==========================================
  Files          68       68              
  Lines        2947     2938       -9     
  Branches      374      374              
==========================================
- Hits         2476     2474       -2     
+ Misses        411      404       -7     
  Partials       60       60              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Copy link
Contributor

@kriswest kriswest left a comment

Choose a reason for hiding this comment

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

I'm ok with dropping the unused query args (which may need to come back one day for server-side pagination or filtering). However, I think API_BASE needs to fall back to location.origin.

I'll raise an issue for the remaining UI services to be converted to TS - they should also use API_BASE (instead of each working it out themselves), but will need the location.origin fallback (I guess).

@andypols
Copy link
Contributor Author

@kriswest Ok - I'm fine with defaulting to location.origin. The original bug I was fixing is that logout defaulted to http://localhost:3000. Not sure if you are saying this PR should do that or the one you are raising for the remaining services?

@kriswest
Copy link
Contributor

kriswest commented Sep 26, 2025

The other services currently default to location.origin - I didn't notice user.ts had lost that in the original PR (but was happy to see the hardcoded http://localhost:3000 fallback go). I think the location.origin fallback needs reinstating here (and can then be used when converting the other services), with the test adjusted to confirm it.

@github-actions github-actions bot added the fix label Sep 26, 2025
Copy link
Contributor

@kriswest kriswest left a comment

Choose a reason for hiding this comment

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

LGTM

@kriswest kriswest merged commit 7030df1 into finos:main Sep 26, 2025
14 checks passed
@andypols andypols deleted the fix-invalid-api-base-url branch September 28, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants