RTK Query Error { status: ‘FETCH_ERROR’, error: ‘TypeError: fetch failed’ } while am hitting an GET api to Fetch Blogs

I am using RTK Queries for Front-end Api Integration and Express js for Backend but while I am hitting a get api to fetch blogs post it will run fine from backend side it will return expected results from backend side but in front end it returns cors error and returns nothing in the response of the api like this one=>
image 1 displaying the error on the network tab while hitting the get api of the fetch blogs
or if I am talking about the response of the api it gives nothing in it but giving 200 status code in the api headers tab like this one=>
enter image description here
enter image description here

but when I am hitting the api from postman the api return the expected result as I want like this one
enter image description here

when I debugg the error on front end then I found that in the apiSliceInterceptor when I am hitting the baseQuery of the redux toolkit for fetching the base query of the api it returns the error just like { status: ‘FETCH_ERROR’, error: ‘TypeError: fetch failed’ }
enter image description here
I can’t understand what’s the error and because of what mistake it is occuring I Unable to solve this error so can you please let me know the solution of it and the reason of the error so it will heipful in understanding for me
I am attaching the apiSliceInterceptor.js file code in which the error is occuring and the configuration of the rtk query is done and I am also attaching the index.js file of the server where I initialize the core on backend if there is any mistake please let me know this is very helpful for me

apiSliceInterceptor file code

import {fetchBaseQuery, retry } from "@reduxjs/toolkit/query/react";

const apiSliceInterceptor ={};



apiSliceInterceptor.baseQuery = fetchBaseQuery({
    baseUrl: "http://localhost:3001",
});

apiSliceInterceptor.baseQueryWithRetry = retry(
    apiSliceInterceptor.baseQueryWithInterceptor,{
        maxRetries:3,
    }
)

apiSliceInterceptor.baseQueryWithInterceptor = async (
    args,
    api,
    extraOptions
) => {
    try {
        const result = await apiSliceInterceptor.baseQuery(args,api,extraOptions);
        if(result.error){
            if(result.error?.data?.message){
              console.log(result.error.data.message)

            }
        }
        return result;
    } catch (error) {
        console.log("error Occur ==========> ", error);
    
    }
}

export {apiSliceInterceptor}

index.js file of the server where cors is initialized

const express = require('express')
const cors= require('cors')
const bodyParser= require('body-parser')
const apiRoutes= require('./apis')
const dotenv = require('dotenv')
dotenv.config()
const app = express()
const port = process.env.APP_PORT
app.use(express.json())
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(apiRoutes)
app.use(cors())
app.get('/', (req, res) => {
    res.send(' web server is running!')
})

app.listen(port, () => {
  console.log(`Example app listening on port http://localhost:${port}`)
})

I am Expecting to resolve this error and why this error is ocurring I am unable to find it

New contributor

Rahul Jat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật