jbolda / gatsby-source-airtable

MIT License
216 stars 43 forks source link

TypeError: tableOptions.tableLinks.map is not a function after plugin upgrade #53

Closed amite closed 5 years ago

amite commented 5 years ago

I tried upgrading gatsby-source-airtable plugin from 2.0.3 ❯ 2.4.2 and the source plugin stopped working and my build has started failing.

The full stacktrace says:

 TypeError: tableOptions.tableLinks.map is not a function

  - gatsby-node.js:75 tables.forEach.tableOptions
    [***]/[gatsby-source-airtable]/gatsby-node.js:75:82

  - Array.forEach

  - gatsby-node.js:46 Object.exports.sourceNodes
    [***]/[gatsby-source-airtable]/gatsby-node.js:46:10

The plugin was working just fine in version 2.0.3

Here is my package.json for reference:

{
  "name": "****",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "develop": "gatsby develop",
    "start": "npm run develop",
    "build": "npm run clean && gatsby build",
    "test": "jest --modulePaths=src",
    "clean": "rm -rf public && rm -rf .cache",
    "serve": "gatsby serve",
    "lint": "eslint --fix ./src"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/***.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/***/issues"
  },
  "homepage": "https://github.com/#readme",
  "devDependencies": {
    "@types/react-dom": "^16.8.4",
    "babel-jest": "^24.8.0",
    "babel-preset-gatsby": "^0.1.11",
    "dotenv": "^8.0.0",
    "eslint": "^5.16.0",
    "eslint-config-gatsby-standard": "^2.1.1",
    "eslint-plugin-jest": "^22.5.1",
    "fs-extra": "^7.0.1",
    "gatsby-plugin-root-import": "^2.0.5",
    "gatsby-plugin-sass": "^2.0.11",
    "gatsby-plugin-webpack-bundle-analyzer": "^1.0.4",
    "husky": "^2.2.0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^24.8.0",
    "jest-dom": "^3.2.0",
    "jest-fetch-mock": "^2.1.2",
    "node-sass": "^4.12.0",
    "prettier": "^1.17.0",
    "pretty-quick": "^1.10.0",
    "prop-types": "^15.7.2",
    "react-hot-loader": "^4.8.4",
    "react-mock": "^6.0.1",
    "react-test-renderer": "^16.8.6",
    "react-testing-library": "^7.0.0"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "dependencies": {
    "@emotion/core": "^10.0.10",
    "@emotion/styled": "^10.0.10",
    "bootstrap": "^4.3.1",
    "cookie": "^0.3.1",
    "final-form": "^4.12.0",
    "final-form-calculate": "^1.3.1",
    "gatsby": "^2.4.2",
    "gatsby-plugin-emotion": "^4.0.6",
    "gatsby-plugin-google-tagmanager": "^2.0.13",
    "gatsby-plugin-react-helmet": "^3.0.12",
    "gatsby-plugin-rollbar": "^1.0.0",
    "gatsby-source-airtable": "^2.0.3",
    "gatsby-source-filesystem": "^2.0.33",
    "qs": "^6.7.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-dropdown": "^1.6.4",
    "react-final-form": "^4.1.0",
    "react-final-form-listeners": "^1.0.2",
    "react-helmet": "^5.2.1",
    "react-intersection-observer": "^8.23.0",
    "react-loadable": "^5.5.0",
    "react-simple-dropdown": "^3.2.3",
    "react-slick": "^0.24.0",
    "slick-carousel": "^1.8.1"
  },
  "husky": {
    "hooks": {
      "pre-commit": "pretty-quick staged"
    }
  }
}

Here is what my mappings config looks like:

    {
      resolve: `gatsby-source-airtable`,
      options: {
        apiKey: process.env.AIRTABLE_API_KEY,
        tables: [
          {
            baseId: process.env.AIRTABLE_BASE_ID,
            tableName: `Homepages`,
            tableView: `Grid view`,
            tableLinks: `SearchByDomainLinks`,
          },
          {
            baseId: process.env.AIRTABLE_BASE_ID,
            tableName: `SearchByDomainLinks`,
            tableView: `Grid view`,
            tableLinks: `Homepages`,
          },
        ],
      },
    },
jbolda commented 5 years ago

👋

I assume you mean that you upgraded gatsby to 2.4.2? If that is the case, I don't quite follow what version of gatsby-source-airtable you are on. We fixed a bug in 2.0.6 that seems like the error you are seeing. Check the release notes here.

fustkilas commented 5 years ago

I have the same error, how can I resolve this?

{
  "name": "gatsby-starter-default",
  "private": true,
  "description": "A simple starter to get up and developing quickly with Gatsby",
  "version": "0.1.0",
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
  "dependencies": {
    "babel-plugin-styled-components": "^1.10.0",
    "dot-env": "0.0.1",
    "gatsby": "^2.4.2",
    "gatsby-image": "^2.0.29",
    "gatsby-plugin-brotli": "^1.0.0",
    "gatsby-plugin-lodash": "^3.0.4",
    "gatsby-plugin-manifest": "^2.0.17",
    "gatsby-plugin-netlify": "^2.0.10",
    "gatsby-plugin-nprogress": "^2.0.8",
    "gatsby-plugin-offline": "^2.0.25",
    "gatsby-plugin-react-helmet": "^3.0.6",
    "gatsby-plugin-sharp": "^2.0.35",
    "gatsby-plugin-styled-components": "^3.0.5",
    "gatsby-plugin-stylus": "^2.0.6",
    "gatsby-plugin-typography": "^2.2.7",
    "gatsby-source-airtable": "^2.0.8",
    "gatsby-source-filesystem": "^2.0.29",
    "gatsby-transformer-remark": "^2.2.4",
    "gatsby-transformer-sharp": "^2.1.13",
    "graphql": "^14.1.1",
    "lodash": "^4.17.11",
    "prop-types": "^15.6.2",
    "react": "^16.8.0",
    "react-dom": "^16.8.0",
    "react-helmet": "^5.2.0",
    "react-imgix": "^8.6.1",
    "react-typography": "^0.16.18",
    "rebass": "^3.0.1",
    "styled-components": "^4.1.3",
    "styled-system": "^5.0.12",
    "typeface-ibm-plex-sans": "0.0.61",
    "typeface-unifrakturmaguntia": "0.0.72",
    "typeface-yatra-one": "0.0.72",
    "typography": "^0.16.18"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop",
    "start": "npm run develop",
    "serve": "gatsby serve",
    "test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/gatsbyjs/gatsby-starter-default"
  },
  "bugs": {
    "url": "https://github.com/gatsbyjs/gatsby/issues"
  }
}
jbolda commented 5 years ago

@fustkilas would you be able to do a little digging for me on this? The first thing I would try would be to upgrade some of your dependencies. It is very difficult for me to provide any guidance just based on a list of possible dependencies.

github-actions[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity for 30 days. It will be closed if no further activity occurs within 7 days. Remove stale label, comment, and/or apply "ongoing issue" label to prevent this from being closed. Thank you for your contributions.