Skip to content

[➕ Feature]: Run a quick sanity check before letting the frontend start #6857

Description

@senpro-ingwersenk

Is your feature request related to a problem? Please describe.
I found another issue with my deployment - and it was, once again, a typo... In my Traefik, I had configured neigh identical priorities for the routes. This had the amousing side effect to randomly serve either the frontend, the backend or the Websocket endpoint depending on how it felt like handling stuff.

And this is partially what breaks the hooks for API, Tags and alike - because once the API and session get invalid data, anything thereafter falls apart. Same goes for WebSocket.

Granted, this is a super edge-case and nieche thing to occur and is entirely a me-problem - but, for the sake of finding and fixing errors, I would like to request a "sanity check" ... "feature".

Describe the solution you'd like
One of the very first hooks to be used is useApi() as it inherently creates the session. Exceptions and outputs from the SWR call here are not really well handled. Make sure that, before returning the object, it is actually usable.

Core hooks like useTags() should themselves also handle errors. They currently don't (seem to do so, anyway).

When establishing the Pusher/WebSocket connection, ensure that it actually succeeds. If it does not, make the error visible. It took me a good forever to track it. The two that tripped the flow ere either invalid or unknown app, and another was invalid data (non-JSON) being returned; because of my routing priority, the websocket endpoint actually returned the frontend's HTML, and that endpoint also does not upgrade to WS, ...obviously. x) So, surfacing these two errors more cleanly could go a long way!

Describe alternatives you've considered
Perhaps a /status endpoint, or a tiny service that can be ran alongside to act as a little health-page? It only really needs to connect to the endpoints and validate that they all are what they are expected to be. Perhaps this can be an entirely isolated route in the Next.js app? I am not too familiar with that, honestly.

Additional context
At this rate I am going to learn the entire Keep source inside out in terms of it's frontend lol x) I hope my tickets are useful though, all jokes aside!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions