NASA-IMPACT / veda-backend

Backend services for VEDA
Other
11 stars 5 forks source link

Issue with absent trailing slash in stac-fastapi #343

Open slesaad opened 6 months ago

slesaad commented 6 months ago

Note: read discussion; some investigation has started

Description

A recent deployment of the veda-backend introduced an issue with the stac-fastapi where absence of a trailing slash causes it to respond with a 307 temporary redirect

See the behavior in https://dev.openveda.cloud/api/stac vs https://dev.openveda.cloud/api/stac/

We ruled out any infrastructure issue by running it locally:

image image

Downgrading to stac-fastapi.api==2.4.5 still has the same behavior

@amarouane-ABDELHAK @vincentsarago @wildintellect

anayeaye commented 6 months ago

Just a note: We've actually been seeing this bug for a long time in the dev instance so it is possible that it is unrelated to recent code changes:

https://dev.openveda.cloud/api/stac redirects to origin (https://dev.openveda.cloud which is a s3 website stac browser) while https://dev.openveda.cloud/api/stac/ properly directs to the stac api.

We hadn't prioritized this work because we didn't realize it was impacting users. We'd been assuming that it was tech debt in smoothing out our cloud front configuration. :(

slesaad commented 6 months ago

Another issue I noticed, the "next" link isn't formed as expected, (look at the last link in the screenshot - missing /api/stac)

image

anayeaye commented 6 months ago

For the pagination issue I think there is a missing self.resolve somewhere in the generation of the next link for pagination in v2.4 stac-fastapi. I'm looking to see if that gets fixed in later versions. Just dropping this note to :ack: the bug.

https://github.com/stac-utils/stac-fastapi/blob/2.4.0/stac_fastapi/pgstac/stac_fastapi/pgstac/models/links.py#L127

anayeaye commented 5 months ago

https://github.com/NASA-IMPACT/veda-backend/pull/358