reduxjs/redux-toolkit

Retry always returns 500 and internal server error

jcjp opened this issue · 1 comments

jcjp commented

Description

  • Using retry from @reduxjs/toolkit/query/react returns a result.error that is always 500 error code and a message of internal server error vs using the base Fetch API from the browser it shows the correct error code, message and data. One of the result that should be expected is a 400 error code with a different custom message.

  • Here is a snippet of my code:

const baseQuery = retry(
  async (args: string | FetchArgs, api, extraOptions) => {
    const result = await fetchBaseQuery({
      baseUrl,
    })(args, api, extraOptions);
    console.log(result); // <-- always 500 and internal server error
    return result;
  },
  {
    maxRetries: 0,
  },
)

Additional Information:

  • OS: Windows 10/11
  • Frontend: RemixJS (^2.8.1)
  • Backend: NestJS
  • @reduxjs/toolkit ^2.2.3
jcjp commented

Figured this out, it's not RTK that's the problem but the our server returning same error response.