Don't display Xano errors in API responses
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
-
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!) -
@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.
-
@sepirak-nick your wish is my command!
We'll clean this up for next week's release.
-
@Sean Montgomery Thank you Sean! Will it be added as an option to toggle off 500 errors from outputting a reason/message?
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback