Don't display Xano errors in API responses

Options

Hi,

Is it possible to not show function stack errors from Xano in the response to the frontend, and instead just show a generic "An internal server error occurred" message?

We grab the "message" field in the response body to show error messages in our UI, but it's unprofessional to display code/DB/internal errors to the user, vs actual user-facing errors. We could just not display the endpoint response message if it's a 500 error, but it is still being sent to the browser.

The errors I'm referring to are code errors, like referencing a path that doesn't exist, DB errors like unique collisions or records not being found, etc. In a normal backend these types of issues would be caught by try/catch type functionality and the error logged in an issue tracker somewhere, but Xano doesn't have that feature.

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    So what I would do is wrap the call in another API call. You have API endpoint A call API endpoint B via an external API request. Then based on the shape of that result, you either return what you heard from endpoint B, or throw an error payload of your choosing. This is the essence of a proxy pattern.

    (And I'm with you on getting try-catch. Would help a lot!)

  • sepirak-nick
    sepirak-nick Member
    Options

    @Ray Deck Hm, we do have a reverse proxy gateway already in place for our API. I suppose that would be as good a spot as any to put it, although I would have liked to solve the issue inside Xano.

  • Sean Montgomery
    Sean Montgomery Administrator

    ADMIN

    Options

    @sepirak-nick your wish is my command!

    We'll clean this up for next week's release.

  • sepirak-nick
    sepirak-nick Member
    Options

    @Sean Montgomery Thank you Sean! Will it be added as an option to toggle off 500 errors from outputting a reason/message?