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

[scd] return proper http code for too big area search on the SCD subscriptions endpoint #985

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

Shastick
Copy link
Contributor

@Shastick Shastick commented Jan 11, 2024

While writing a scenario for the uss_qualifier I ran into a situation where the DSS does not use the proper HTTP code when the requested are is too large for subscription queries in the SCD context.

As per specification, in this situation, we should receive a 413 code, and not the observed 500 one.

The location in the code was found through the following DSS logs:

2024-01-11T13:51:43.660Z	error	errors/errors.go:81	Error during unary server call	{"error_id": "E:7998749e-a7f4-4a2b-a39c-46d7dac2e222", "stacktrace": "Got an unexpected error\n --- at /app/pkg/scd/subscriptions_handler.go:443 (Server.QuerySubscriptions) ---\nCaused by: Error searching Subscriptions in repo\n --- at /app/pkg/scd/subscriptions_handler.go:414 (Server.QuerySubscriptions.func1) ---\nCaused by: Could not calculate spatial covering\n --- at /app/pkg/scd/store/cockroach/subscriptions.go:313 (repo.SearchSubscriptions) ---\nCaused by: Area is too large (510062190.739560km² > 2500.000000km²)\n --- at /app/pkg/geo/s2.go:177 (Covering) ---\nCaused by: Area too large\n --- at /app/pkg/geo/errors.go:31 (init) ---", "error": "Area too large", "code": 0}

The proposed fix solves the issue: when running against a local build of the DSS, I observed the proper HTTP code being returned when the requested search area was too big.

@Shastick Shastick marked this pull request as draft January 11, 2024 14:03
@Shastick Shastick marked this pull request as ready for review January 11, 2024 14:10
Copy link
Member

@BenjaminPelletier BenjaminPelletier left a comment

Choose a reason for hiding this comment

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

Awesome, thanks :)

@BenjaminPelletier BenjaminPelletier merged commit 095ca48 into interuss:master Jan 11, 2024
6 checks passed
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.

2 participants