Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMR-10200: Fixing stringifyQuery by using qs's version #369

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

william-valencia
Copy link
Contributor

@william-valencia william-valencia commented Nov 4, 2024

When using cmr-stac and specifying an intersects Point parameter via pystac, cmr-stac responds with an "APIError: {"errors":["Oops! Something has gone wrong. We have been alerted and are working to resolve the problem. Please try your request again later."]}"

What is actually happening is that the initial call is succeeding, but pystac is trying to get all the items, and cmr-stac fails when the next link is called. The next link is specified as follows: http://localhost:3000/stac/LPCLOUD/search?datetime=2024-01-01T00%3A00%3A00Z%2F2024-03-31T23%3A59%3A59Z&collections=HLSS30_2.0&intersects%5Btype%5D=Point&intersects%5Bcoordinates%5D=-105.97%2C35.78&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDkwNTY0NTAxMzAsMjg4MTI1MDg4OF0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwOTA1NjQ1MDEzMCwyODgxMjUwODg4XSJ9

The failing part is the "intersects[coordinates]=-105.97,35.78" which cmr-stac's stringifyQuery function generates. On the next call, cmr-stac interprets this as a string although it is expecting an array and errors out.

The solution is to modify the stringifyQuery function to actually return an array, which is what cmr-stac is expecting. Luckily the "qs" library has such a function that does this well.

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.05%. Comparing base (82d4a9b) to head (e8026f4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #369      +/-   ##
==========================================
- Coverage   88.62%   88.05%   -0.57%     
==========================================
  Files          24       24              
  Lines        1169     1164       -5     
  Branches      257      256       -1     
==========================================
- Hits         1036     1025      -11     
- Misses        133      139       +6     

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

@william-valencia william-valencia merged commit 7a0fcb8 into master Nov 6, 2024
5 checks passed
@william-valencia william-valencia deleted the CMR-10200 branch November 6, 2024 20:51
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.

4 participants