Skip to content

Conversation

@testower
Copy link
Contributor

@testower testower commented Jun 11, 2024

Debug client is broken if VITE_API_URL is a relative path (which it is by default). This is due to a breaking change in v7.0.0 of graphql-request, which I overlooked when approving the upgrade: https://github.com/jasonkuhrt/graphql-request/releases/tag/7.0.0

This PR checks validity of VITE_API_URL by passing it to the URL constructor. If exception is thrown, we prefix it with the window's origin (which used to be the default behavior).

I still need to test this PR Tested locally.

@codecov
Copy link

codecov bot commented Jun 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.63%. Comparing base (ef530a6) to head (0177051).
Report is 24 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5899      +/-   ##
=============================================
+ Coverage      68.61%   68.63%   +0.02%     
- Complexity     16823    16837      +14     
=============================================
  Files           1927     1927              
  Lines          72942    72955      +13     
  Branches        7476     7482       +6     
=============================================
+ Hits           50050    50075      +25     
+ Misses         20318    20299      -19     
- Partials        2574     2581       +7     

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

@testower testower force-pushed the fix-graphql-request-breaking-change-in-url branch from 8339d62 to 0177051 Compare June 11, 2024 10:14
@testower testower marked this pull request as ready for review June 11, 2024 10:14
@testower testower requested a review from a team as a code owner June 11, 2024 10:14
try {
// the URL constructor will throw exception if endpoint is not a valid URL,
// e.g. if it is a relative path
new URL(endpoint);
Copy link
Member

Choose a reason for hiding this comment

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

Does this line do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it throws an exception if endpoint is not a valid URL

Copy link
Member

Choose a reason for hiding this comment

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

🤦 oh ok, reading the comments helps

@leonardehrenfried
Copy link
Member

As agreed with the dev team, this only needs a single reviewer.

@leonardehrenfried leonardehrenfried merged commit 1a720cc into opentripplanner:dev-2.x Jun 11, 2024
t2gran pushed a commit that referenced this pull request Jun 11, 2024
@t2gran t2gran added this to the 2.6 (next release) milestone Jul 23, 2024
@t2gran t2gran deleted the fix-graphql-request-breaking-change-in-url branch February 13, 2025 16:13
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.

3 participants