Typeerror: terminated

854 Views Asked by At

I am getting this error while stating my Next js project v 12.2.2. Two api called at root from laravel v 10. It's working fine in my friend computer. I don't understand what causing this error.Error_log.

This where i am calling an api - website-setup and NEXT_PUBLIC_BASE_URL = http://127.0.0.1:8000

axios
      .get(`${process.env.NEXT_PUBLIC_BASE_URL}api/website-setup`)
      .then((res) => {
        // handle success
        dispatch(setupAction(res.data));
        localStorage.setItem(
          "settings",
          JSON.stringify(res.data && res.data.setting)
        );
        localStorage.setItem("pusher", JSON.stringify(res.data && res.data.pusher_info ? res.data.pusher_info :null));
        if (res.data) {
          setFbPixel(res.data.facebookPixel);
          localStorage.setItem("language", JSON.stringify(res.data.language));
          const checkLangExists = localStorage.getItem("language");
          if (checkLangExists) {
            setLoad(false);
            if(!messageWid){
              if(localStorage.getItem("pusher")){
                const pusher = JSON.parse(localStorage.getItem("pusher"));
                setMessageWid(pusher);
              }
            }
          }
        }
      })
      .catch((error) => {
        // handle error
        console.log(error);
      });

The data comming from back end

{
 "setting": {
        "logo": null,
        "favicon": null,
        "enable_user_register": 1,
        "phone_number_required": 1,
        "default_phone_code": "IN",
        "enable_multivendor": 1,
        "text_direction": "LTR",
        "timezone": "Asia/Calcutta",
        "topbar_phone": null,
        "topbar_email": "[email protected]",
        "currency_icon": "₹",
        "currency_name": "INR",
        "show_product_progressbar": 1,
        "theme_one": "#fffb00",
        "theme_two": "#b1a306",
        "seller_condition": null
    },
    "maintainance": {
        "id": 1,
        "status": 0,
        "image": "",
        "description": "",
        "created_at": "2023-07-24T12:58:38.000000Z",
        "updated_at": "2023-07-24T12:58:38.000000Z"
    },
    "flashSaleActive": true,
    "flashSale": {
        "status": 1,
        "offer": 10,
        "end_time": "2023-07-24"
    },
    "flashSaleProducts": [],
    "announcementModal": {
        "id": 1,
        "status": 1,
        "title": "GET UP TO 75% OFF",
        "description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Exercitationem, facere nesciunt doloremque nobis debitis sint?",
        "image": "uploads/website-images/announcement-2022-11-19-12-33-21-4518.png",
        "expired_date": 5,
        "created_at": "2023-07-24T12:58:39.000000Z",
        "updated_at": "2023-07-24T12:58:39.000000Z"
    },
    "productCategories": [],
    "megaMenuCategories": [],
    "megaMenuBanner": {
        "id": 10,
        "header": null,
        "title": null,
        "link": "https://shopo-ecom.vercel.app/products?category=game",
        "image": "storage/uploads/website-images/Mega-menu-2022-10-27-01-44-55-7811.png",
        "banner_location": "Megamenu banner",
        "after_product_qty": 0,
        "status": 1,
        "created_at": null,
        "updated_at": null,
        "title_one": "SMART WATCH",
        "title_two": "Samsung Smart Watch",
        "badge": "",
        "product_slug": "electronics"
    },
    "customPages": [],
    "googleAnalytic": {
        "id": 1,
        "analytic_id": "5248-fd-5fds",
        "status": 1,
        "created_at": "2023-07-24T12:58:39.000000Z",
        "updated_at": "2023-07-24T12:58:39.000000Z"
    },
    "facebookPixel": {
        "id": 1,
        "status": 1,
        "app_id": "fsdf45sdf4sdf",
        "created_at": "2023-07-24T12:58:39.000000Z",
        "updated_at": "2023-07-24T12:58:39.000000Z"
    },
    "tawk_setting": null,
    "cookie_consent": {
        "id": 1,
        "status": 1,
        "border": "thin",
        "corners": "normal",
        "background_color": "#184dec",
        "text_color": "#fafafa",
        "border_color": "#0a58d6",
        "btn_bg_color": "#fffceb",
        "btn_text_color": "#222758",
        "message": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the when an unknown printer took.",
        "link_text": "More Info",
        "btn_text": "Yes",
        "link": null,
        "created_at": "2023-07-24T12:58:39.000000Z",
        "updated_at": "2023-07-24T12:58:39.000000Z"
    },
    "seo_setting": [
        {
            "id": 1,
            "page_name": "Home Page",
            "seo_title": "Home - Welcome to ShopO",
            "seo_description": "A best ecommerce script",
            "created_at": null,
            "updated_at": null
        },
        {
            "id": 2,
            "page_name": "About Us",
            "seo_title": "About Us - Ecommerce",
            "seo_description": "About Us",
            "created_at": null,
            "updated_at": null
        },
        {
            "id": 3,
            "page_name": "Contact Us",
            "seo_title": "Contact Us - Ecommerce",
            "seo_description": "Contact Us",
            "created_at": null,
            "updated_at": null
        },
        {
            "id": 4,
            "page_name": "Seller Page",
            "seo_title": "Our Seller - Ecommerce",
            "seo_description": "Seller Page",
            "created_at": null,
            "updated_at": null
        },
        {
            "id": 5,
            "page_name": "Blog",
            "seo_title": "Blog - Ecommerce",
            "seo_description": "Blog",
            "created_at": null,
            "updated_at": null
        },
        {
            "id": 6,
            "page_name": "Flash Deal",
            "seo_title": "Flash Deal - Ecommerce",
            "seo_description": "Flash Deal",
            "created_at": null,
            "updated_at": null
        },
        {
            "id": 7,
            "page_name": "Shop Deal",
            "seo_title": "Shop Deal - Ecommerce",
            "seo_description": "Shop Deal",
            "created_at": null,
            "updated_at": null
        }
    ],
    "filter_price_range": 5000,
    "footer_first_col": {
        "col_links": [],
        "columnTitle": "Feature"
    },
    "footer_second_col": {
        "col_links": [],
        "columnTitle": "General Links"
    },
    "footer_third_col": {
        "col_links": [],
        "columnTitle": "Helpful"
    },
    "footer": {
        "id": 1,
        "about_us": "We know there are a lot of threa developers our but we pride into a firm in the industry.",
        "phone": "+91 01682 825 123",
        "email": "[email protected]",
        "address": "Gazipara lane, Dhaltitha, 743412",
        "first_column": "Feature",
        "second_column": "General Links",
        "third_column": "Helpful",
        "copyright": "©2023 Digital Melodic - All rights reserved",
        "payment_image": "uploads/website-images/payment-card-2022-09-26-12-59-29-8933.png",
        "created_at": "2023-07-24T12:58:39.000000Z",
        "updated_at": "2023-07-24T12:58:39.000000Z"
    },
    "social_links": [],
    "image_content": {
        "empty_cart": null,
        "empty_wishlist": null,
        "change_password_image": null,
        "become_seller_avatar": null,
        "become_seller_banner": null,
        "login_image": null,
        "error_page": null
    }
}

This is what am i getting in terminal

error - TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:7091:53)
    at Fetch.emit (node:events:513:28)
    at Fetch.terminate (node:internal/deps/undici/undici:6352:14)
    at Object.onError (node:internal/deps/undici/undici:7185:36)
    at Request.onError (node:internal/deps/undici/undici:2643:31)
    at errorRequest (node:internal/deps/undici/undici:4585:17)
    at Socket.onSocketClose (node:internal/deps/undici/undici:4040:9)
    at Socket.emit (node:events:513:28)
    at TCP.<anonymous> (node:net:313:12) {
  page: '/',
  [cause]: SocketError: closed
      at Socket.onSocketClose (node:internal/deps/undici/undici:4028:35)
      at Socket.emit (node:events:513:28)
      at TCP.<anonymous> (node:net:313:12) {
    code: 'UND_ERR_SOCKET',
    socket: {
      localAddress: undefined,
      localPort: undefined,
      remoteAddress: undefined,
      remotePort: undefined,
      remoteFamily: undefined,
      timeout: undefined,
      bytesWritten: 175,
      bytesRead: 4006
    }
  }

0

There are 0 best solutions below