Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: [object Object] is not iterable!↵ at push../node_modules/@babel/runtime-corejs2/node_modules/core-js/library/modules/_for-of.js.module.exports #11180

Open
juansalvatore opened this issue Feb 27, 2020 · 5 comments

Comments

@juansalvatore
Copy link

@juansalvatore juansalvatore commented Feb 27, 2020

Bug Report

  • I would like to work on a fix!

Current Behavior
A clear and concise description of the behavior.
I'm getting the following error after upgrading to next v9:

"TypeError: [object Object] is not iterable!
    at push../node_modules/@babel/runtime-corejs2/node_modules/core-js/library/modules/_for-of.js.module.exports (http://localhost:3000/_next/static/runtime/main.js?ts=1582833143367:1602:42)
    at http://localhost:3000/_next/static/runtime/main.js?ts=1582833143367:1326:34
    at new Map (http://localhost:3000/_next/static/development/pages/searchPage.js?ts=1582833143367:24950:34)
    at regionsReducer (http://localhost:3000/_next/static/development/pages/_app.js?ts=1582833143367:227410:30)
    at combination (http://localhost:3000/_next/static/development/pages/searchPage.js?ts=1582833143367:172965:29)
    at p (<anonymous>:1:36402)
    at v (<anonymous>:1:36684)
    at <anonymous>:1:40069
    at Object.dispatch (http://localhost:3000/_next/static/development/pages/searchPage.js?ts=1582833143367:172719:22)
    at e (<anonymous>:1:40553)
    at http://localhost:3000/_next/static/development/pages/_app.js?ts=1582833143367:182911:16
    at dispatch (http://localhost:3000/_next/static/development/pages/searchPage.js?ts=1582833143367:173144:28)
    at http://localhost:3000/_next/static/development/pages/searchPage.js?ts=1582833143367:212336:9"

Input Code

  • REPL or Repo link if applicable:
    We have this code.
 case GET_REGIONS_BY_ID: {
      const fetchedRegions = new Map(state.fetchedRegions)

Expected behavior/code
A clear and concise description of what you expected to happen (or code).

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
{
  "presets": ["next/babel"],
  "plugins": [
    [
      "@babel/plugin-transform-runtime",
      {
        "absoluteRuntime": false,
        "corejs": false,
        "helpers": true,
        "regenerator": true,
        "useESModules": false,
        "version": "7.0.0-beta.0"
      }
    ],
    ["babel-plugin-root-import"],
    ["styled-components", { "ssr": true, "pure": true }],
    [
      "import",
      {
        "libraryName": "@material-ui/core",
        "libraryDirectory": "",
        "camel2DashComponentName": false
      },
      "import/core"
    ],
    [
      "import",
      {
        "libraryName": "@material-ui/icons",
        "libraryDirectory": "",
        "camel2DashComponentName": false
      },
      "import/icons"
    ]
  ],
  "env": {
    "test": {
      "presets": [["next/babel", { "preset-env": { "modules": "commonjs" } }]]
    }
  }
}

Environment

npx: installed 1 in 1.124s

  System:
    OS: macOS 10.15.3
  Binaries:
    Node: 12.13.1 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.12.1 - /usr/local/bin/npm
  npmPackages:
    @babel/core: ^7.8.6 => 7.8.6 
    @babel/plugin-transform-runtime: ^7.8.3 => 7.8.3 
    babel-eslint: ^10.1.0 => 10.1.0 
    babel-jest: ^24.1.0 => 24.9.0 
    babel-loader: ^8.0.5 => 8.0.6 
    babel-plugin-import: ^1.12.2 => 1.13.0 
    babel-plugin-module-resolver: ^3.2.0 => 3.2.0 
    babel-plugin-root-import: ^5.1.0 => 5.1.0 
    babel-plugin-styled-components: ^1.10.7 => 1.10.7 
    babel-runtime: ^6.26.0 => 6.26.0 
    eslint: ^6.8.0 => 6.8.0 
    eslint-import-resolver-babel-plugin-root-import: ^1.1.1 => 1.1.1 
    jest: ^24.1.0 => 24.9.0 

Possible Solution

I'm not sure if we need to upgrade some dependency or we need a polyfill. It's weird that after upgrading from next js 8 to 9 we get this issue.

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

@babel-bot

This comment has been minimized.

Copy link
Collaborator

@babel-bot babel-bot commented Feb 27, 2020

Hey @juansalvatore! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Feb 27, 2020

Can you add console.log(Symbol.iterator in state.fetchedRegions, state.fetchedRegions, state.fetchedRegions[Symbol.iterator])?

@ethanryan

This comment has been minimized.

Copy link

@ethanryan ethanryan commented Feb 27, 2020

hi @nicolo-ribaudo, thanks for your quick response.

i'm working on this with @juansalvatore.

console.logging that logs:

{fetchedRegions: Map, boroughTree: Array(0)}

@JLHwung

This comment has been minimized.

Copy link
Contributor

@JLHwung JLHwung commented Feb 27, 2020

Can you log the constructor of the state.fetchedRegions?

console.log(state.fetchedRegions.constructor)

I doubt that state.fetchedRegions is not constructed from the builtin Map.

@ethanryan

This comment has been minimized.

Copy link

@ethanryan ethanryan commented Feb 27, 2020

may have misunderstood your question.

i'm doing:

console.log('qqq0 - state.fetchedRegions.constructor', state.fetchedRegions.constructor)
console.log('qqq1 - Symbol.iterator in state.fetchedRegions: ', Symbol.iterator in state.fetchedRegions)
console.log('qqq2 - state.fetchedRegions: ', state.fetchedRegions)
console.log('qqq3 - state.fetchedRegions[Symbol.iterator]', state.fetchedRegions[Symbol.iterator])`

in the browser:

logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.