Skip to content

Fix infinite request loop if metadata request fails#3948

Merged
tillprochaska merged 1 commit intodevelopfrom
fix/3812-handle-api-errors
Oct 22, 2024
Merged

Fix infinite request loop if metadata request fails#3948
tillprochaska merged 1 commit intodevelopfrom
fix/3812-handle-api-errors

Conversation

@tillprochaska
Copy link
Contributor

Fixes #3812. Previously, the UI would retry the metadata request indefinitely and without a delay. Now, if the metadata request fails, an error message and a button to reload the page are displayed.

I haven’t implemented automatic retries with back-offs for now, as this adds complexity and I’m not sure it’s necessary.

Screen Shot 2024-10-22 at 11 38 59

Fixes #3812. Previously, the UI would retry the metadata request indefinitely and without a delay. Now, if the metadata request fails, an error message and a button to reload the page are displayed.

I haven’t implemented automatic retries with back-offs for now, as this adds complexity and I’m not sure it’s necessary.
@tillprochaska tillprochaska force-pushed the fix/3812-handle-api-errors branch from 4e8ebcb to 5ef2720 Compare October 22, 2024 09:42
@tillprochaska tillprochaska marked this pull request as ready for review October 22, 2024 09:49
Copy link
Contributor

@stchris stchris left a comment

Choose a reason for hiding this comment

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

Very nice, I like the pragmatic change with the Reload button.

@tillprochaska tillprochaska merged commit 19adc88 into develop Oct 22, 2024
tillprochaska added a commit that referenced this pull request Nov 12, 2024
Fixes #3999.

This is related to #3948 in which I fixed the infinite request loop in case requests to the metadata API fail. This works as intended, but has one unintended side effect: We were actually kind of relying on the previous behavior to handle expired session tokens.

For context: When a user logs in, the session token is stored. When the session token expires, future API requests using that session token will obviously fail. The UI was previously handling 401 response codes to invalidate the stored session token and display a login popup or redirect to the OAuth service.

The change introduced in #3948 also prevented the handling of requests that failed to expired session tokens. I’m not convinced that this way of handling expired session tokens is a good solution as it’s pretty opaque.

So with this change, we will keep the newly introduced behavior (which shows an error message and a "Retry" button) in case a request to the metadata API fails, *except* if it failed with a 401 response in which case we still do whatever happened before.
tillprochaska added a commit that referenced this pull request Nov 12, 2024
Fixes #3999.

This is related to #3948 in which I fixed the infinite request loop in case requests to the metadata API fail. This works as intended, but has one unintended side effect: We were actually kind of relying on the previous behavior to handle expired session tokens.

For context: When a user logs in, the session token is stored. When the session token expires, future API requests using that session token will obviously fail. The UI was previously handling 401 response codes to invalidate the stored session token and display a login popup or redirect to the OAuth service.

The change introduced in #3948 also prevented the handling of requests that failed to expired session tokens. I’m not convinced that this way of handling expired session tokens is a good solution as it’s pretty opaque.

So with this change, we will keep the newly introduced behavior (which shows an error message and a "Retry" button) in case a request to the metadata API fails, *except* if it failed with a 401 response in which case we still do whatever happened before.
tillprochaska added a commit that referenced this pull request Nov 19, 2024
Fixes #3999.

This is related to #3948 in which I fixed the infinite request loop in case requests to the metadata API fail. This works as intended, but has one unintended side effect: We were actually kind of relying on the previous behavior to handle expired session tokens.

For context: When a user logs in, the session token is stored. When the session token expires, future API requests using that session token will obviously fail. The UI was previously handling 401 response codes to invalidate the stored session token and display a login popup or redirect to the OAuth service.

The change introduced in #3948 also prevented the handling of requests that failed to expired session tokens. I’m not convinced that this way of handling expired session tokens is a good solution as it’s pretty opaque.

So with this change, we will keep the newly introduced behavior (which shows an error message and a "Retry" button) in case a request to the metadata API fails, *except* if it failed with a 401 response in which case we still do whatever happened before.
simonwoerpel pushed a commit to openaleph/openaleph that referenced this pull request Sep 24, 2025
Fixes alephdata#3999.

This is related to alephdata#3948 in which I fixed the infinite request loop in case requests to the metadata API fail. This works as intended, but has one unintended side effect: We were actually kind of relying on the previous behavior to handle expired session tokens.

For context: When a user logs in, the session token is stored. When the session token expires, future API requests using that session token will obviously fail. The UI was previously handling 401 response codes to invalidate the stored session token and display a login popup or redirect to the OAuth service.

The change introduced in alephdata#3948 also prevented the handling of requests that failed to expired session tokens. I’m not convinced that this way of handling expired session tokens is a good solution as it’s pretty opaque.

So with this change, we will keep the newly introduced behavior (which shows an error message and a "Retry" button) in case a request to the metadata API fails, *except* if it failed with a 401 response in which case we still do whatever happened before.
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.

BUG: Metadata API Request Error Handling

2 participants