Search code examples
reactjstypescriptnext.jschakra-ui

TypeError: Object.fromEntries is not a function


I am getting this error on some older iPhones (like iPhone 7 and iPhone 10)

TypeError: Object.fromEntries is not a function

I am unable to find the solution.

Libraries that I am using

 "@chakra-ui/react": "^1.4.1",
    "@chakra-ui/theme-tools": "^1.1.7",
    "@emotion/styled": "^11",
    "@stripe/react-stripe-js": "^1.2.0",
    "@stripe/stripe-js": "^1.11.0",
    "agora-rtc-sdk": "3.3.1",
    "agora-rtm-sdk": "1.4.1",
    "aws-sdk": "^2.828.0",
    "axios": "^0.21.1",
    "browser-image-compression": "^1.0.14",
    "crypto-js": "^4.0.0",
    "dayjs": "^1.10.3",
    "firebase": "^8.2.4",
    "framer-motion": "4.1.11",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.20",
    "nanoid": "^3.1.20",
    "next": "^11.0.1",
    "next-cookies": "^2.0.3",
    "next-pwa": "^5.0.6",
    "nextjs-redirect": "^5.0.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-feather": "^2.0.9",
    "react-hot-toast": "^1.0.2",
    "react-image-magnify": "^2.7.4",
    "react-player": "^2.7.2",
    "react-redux": "^7.2.2",
    "react-select": "^4.0.2",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "swiper": "^6.7.5",
    "use-http": "^1.0.18",
    "video.js": "^7.10.2",
    "yup": "^0.32.9"

Things I tried

  1. Upgrading NodeJS from Version 12 to Version 14.17.1 (But this did not help)

Solution

  • The solution was install the polyfill for Object.fromEntries and import it into the _app.tsx file.

    1. polyfill-object.fromentries