title: Getting a fetch error using redux toolkit and RTK-Query
body: <p>I am using RTK-Query, and Redux-toolkit for this app, and I created an api-slice with createApi, as per the docs.</p>
  <p>When I run a request to the backend, I get a <code>&quot;FETCH_ERROR&quot;</code>; however, when I run the same request using Axios, I get the data correctly from the backend, which leads me to believe I have an error in my code. I am just not sure where exactly it is.</p>
  <p>Here is the error:</p>
  <pre class="lang-js prettyprint-override"><code>Object {
    &quot;api&quot;: Object {
      &quot;config&quot;: Object {
        &quot;focused&quot;: true,
        &quot;keepUnusedDataFor&quot;: 60,
        &quot;middlewareRegistered&quot;: true,
        &quot;online&quot;: true,
        &quot;reducerPath&quot;: &quot;api&quot;,
        &quot;refetchOnFocus&quot;: false,
        &quot;refetchOnMountOrArgChange&quot;: false,
        &quot;refetchOnReconnect&quot;: false,
      },
      &quot;mutations&quot;: Object {},
      &quot;provided&quot;: Object {},
      &quot;queries&quot;: Object {
        &quot;test(undefined)&quot;: Object {
          &quot;endpointName&quot;: &quot;test&quot;,
          &quot;error&quot;: Object {
            &quot;error&quot;: &quot;TypeError: Network request failed&quot;,
            &quot;status&quot;: &quot;FETCH_ERROR&quot;,
          },
          &quot;requestId&quot;: &quot;BWOuLpOxoDKTzlUYFLW4x&quot;,
          &quot;startedTimeStamp&quot;: 1643667104869,
          &quot;status&quot;: &quot;rejected&quot;,
        },
      },
      &quot;subscriptions&quot;: Object {
        &quot;test(undefined)&quot;: Object {
          &quot;QJSCV641RznGWyudGWuMb&quot;: Object {
            &quot;pollingInterval&quot;: 0,
            &quot;refetchOnFocus&quot;: undefined,
            &quot;refetchOnReconnect&quot;: undefined,
          },
        },
      },
    },
    &quot;test&quot;: Object {
      &quot;data&quot;: Array [],
    },
  }
  </code></pre>
  <p>Here is the test slice:</p>
  <pre class="lang-js prettyprint-override"><code>import { createSlice } from &quot;@reduxjs/toolkit&quot;;
  
  const testSlice = createSlice({
    name: &quot;test&quot;,
    initialState: {
      data: [],
    },
    reducers: {
      getData: (state) =&gt; {
        state;
      },
    },
  });
  
  export const { getData } = testSlice.actions;
  export default testSlice.reducer;
  </code></pre>
  <p>Here is the apiSlice:</p>
  <pre class="lang-js prettyprint-override"><code>import { createApi, fetchBaseQuery } from &quot;@reduxjs/toolkit/query/react&quot;;
  
  export const apiSice = createApi({
    reducerPath: &quot;test&quot;,
    baseQuery: fetchBaseQuery({ baseUrl: process.env.REACT_APP_backend_url }),
    endpoints: (builder) =&gt; ({
      test: builder.query({
        query: () =&gt; &quot;/test&quot;,
      }),
    }),
  });
  
  export const { useTestQuery } = apiSice;
  </code></pre>