jbolda / gatsby-source-airtable

MIT License
216 stars 43 forks source link

warn Multiple node fields resolve to the same GraphQL field #157

Closed havietduc91 closed 4 years ago

havietduc91 commented 4 years ago

Firstly, thank you all for the greate package.

I'm facing the issue when I'm running gatsby develop command. Below are the error messages:

warn Multiple node fields resolve to the same GraphQL field `Airtable.data.Project` - [`Project`, `Project___NODE`]. Gatsby will use `Project___NODE`.
warn Multiple node fields resolve to the same GraphQL field `Airtable.data.Publication` - [`Publication`, `Publication___NODE`]. Gatsby will use `Publication___NODE`.

Package versions:

"gatsby": "^2.18.13",
"gatsby-source-airtable": "^2.0.8",

So anyone has the solution to resolve yet? Many thanks

jbolda commented 4 years ago

Would you be able to share your gatsby-config.js?

havietduc91 commented 4 years ago

Hi @jbolda , here you are

{
      resolve: `gatsby-source-airtable`,
      options: {
        apiKey: '*****',
        tables: [
          {
            baseId: `*******`,
            tableName: `Organization`,
            queryName: `Organization`, // optional
            mapping: {
              Logo: `fileNode`
            }, // optional, e.g. "text/markdown", "fileNode"
            tableLinks: [
              `Project`,
              `Roles`,
            ],
          },
          {
            baseId: `*******`,
            tableName: `Concept`,
            queryName: `Concept`, // optional
            tableLinks: [
              `Project`,
            ] // optional, for deep linking to records across tables.
          },
          {
            baseId: `*******`,
            tableName: `Person`,
            queryName: `Person`, // optional
          },
          {
            baseId: `*******`,
            tableName: `Project`,
            queryName: `Project`, // optional
            tableLinks: [
              `Concept`,
              `Organization`,
              `Results`,
            ] // optional, for deep linking to records across tables.
          },
          {
            baseId: `*******`,
            tableName: `Publication`,
            queryName: `Publication`, // optional
          },
        ]
      }
paulevans commented 4 years ago

For what it's worth I found name collisions between Field names and Table names. I renamed my tables to XyzTable - e.g. Product to ProductTable ... and it generated without those collisions.

jbolda commented 4 years ago

I am also suspecting that the issue is collisions between the types. It isn't clear what the exact collision is with just your config, but I imagine there are overlapping column names compared across tables.

We actually released a new version that let's you configure the type names for both the parent nodes and their children nodes (e.g. those created from the mapping property). I imagine configuring the types may resolve your issue, but you will need to adjust your queries to match. https://github.com/jbolda/gatsby-source-airtable/releases/tag/2.1.0

havietduc91 commented 4 years ago

Thank you all for your suggestion, let me try and I will inform you If it has done, many thanks

github-actions[bot] commented 4 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.