Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Return 504 Gateway Timeout with meaningful error on Saturn timeout #35

Closed
lidel opened this issue Feb 14, 2023 · 4 comments
Closed

Return 504 Gateway Timeout with meaningful error on Saturn timeout #35

lidel opened this issue Feb 14, 2023 · 4 comments
Assignees

Comments

@lidel
Copy link
Collaborator

lidel commented Feb 14, 2023

Timeout for getting a block from saturn:

https://github.com/ipfs/bifrost-gateway/blob/15477831722cc3fe1f5e64b3ca7d8a755825178b/blockstore.go#L17

Should

  • produce 504 Gateway Timeout, and not 400 Bad Request.
  • have human-readable error informing about Saturn CDN not returning block

2023-02-14-044028_1716x489_scrot

@hacdias hacdias self-assigned this Feb 14, 2023
@hacdias
Copy link
Collaborator

hacdias commented Feb 14, 2023

I am not implementing this right now, but I am leaving here some notes on how to do this:

  1. In go-libipfs/gateway:
    a. Create and export a new error ErrGatewayTimeout
    b. If the previous error is returned from any API call, we should errors.Is and return 504.
  2. In bifrost-gateway:
    a. Detect "context deadline exceeded" errors from the block store and convert them into gateway.ErrGatewayTimeout.

I think it could also be useful to have 502 Bad Gateway. In filecoin-saturn/caboose#19, we are exposing ErrNoBackend, which effectively has the same meaning as 502 since we could not proxy the request. Alternatively, we could keep returning 500, but I would prefer not to and be more specific.

@lidel
Copy link
Collaborator Author

lidel commented Feb 16, 2023

Related: filecoin-saturn/L1-node#222

bifrost-gateway is using Saturn L1s as gateways.
We should return 504 on timeouts, and 502 on instant failures of these L1s.

Once filecoin-saturn/caboose#28 is done, we should be able to tell when to return 504 (timeouts and 504 codes from remote L1) and when 502 (every other err coming from caboose)

@lidel
Copy link
Collaborator Author

lidel commented Feb 18, 2023

filecoin-saturn/caboose@9b01561 makes errors more useful, they now include status code from L1

@lidel
Copy link
Collaborator Author

lidel commented Feb 24, 2023

Done in #52 which got merged as part of #50

@lidel lidel closed this as completed Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants