"Something went wrong." Why RedwoodJS masks GraphQL errors

You’ve written a service, run a query in your Cell or maybe tried to mutate some data and now … “Something went wrong.”

RedwoodJS masks errors from that bubble up from the api side through the GraphQL Server.

Maybe you’ve seen “database cannot accept more connections” or “did you mean to query title” in some responses when building other apps or other graphQL backed apps?

Redwood masks by default for a reason.

In many GraphQL servers, when an error is thrown, the details of that error are leaked to the outside world. The error and its message are then returned in the response and a client might reveal those errors in logs or even render the message to the user. You could potentially leak sensitive or other information about your app you don’t want to share—such as database connection failures or even the presence of certain fields.

Not to worry, you can still:

  1. Get the full error message in your API logs
  2. Send those logs in Production to a log provider to trace back and collect the errors
  3. Customize the default error message
  4. Use Redwood error types to surface custom error messages

To find out how, see the GraphQL Error Masking and Redwood Logger documentation.

1 Like