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

Field type mismatch in Airtable means field doesn't show up at all in Gatsby #350

Open
dbvisel opened this issue Jul 29, 2021 · 1 comment

Comments

@dbvisel
Copy link

dbvisel commented Jul 29, 2021

Hi! I'm having a strange issue. I have a project where I'm importing a bunch of tables, which have wildly different field names – at this stage I have probably 30 field names I'm dealing with. The problem that I'm running into is that a handful of them seem to periodically disappear from the schema and I can't figure out why. If I go into GraphiQL and do something like this:

{
  allAirtable {
    nodes {
      data
  }
}

it will fill up with the name of all the fields I see in Airtable except for three. I can't figure out why this should be – especially since I've managed to access them in Gatsby – a build this morning was working locally, but when I put it up on Netlify – and didn't touch Airtable in the interim – it failed with an error that's become very familiar:

"gatsby-node.js" threw an error while running the createPages lifecycle:

Cannot query field "Quantities_in_Weight" on type "AirtableData".

  GraphQLError: Cannot query field "Quantities_in_Weight" on type "AirtableData".
  
  - graphql-runner.ts:105 GraphQLRunner.validate
    [sr3]/[gatsby]/src/query/graphql-runner.ts:105:16

Running "gatsby clean" to get rid of the cache and rebuilding doesn't help. However, if I go to Airtable and change, for example, the field name "Quantities in Weight" to "Quantities in Weightt" I get a more promising error:

Cannot query field "Quantities_in_Weight" on type "AirtableData". Did you mean "Quantities_in_Weightt"?

So now it's coming in, though under the wrong name. But if I then change the name back in Airtable and rebuild – which you might imagine would fix the problem – that's no good. It feels like particular names are cursed!

As I mentioned at the start, I'm importing a bunch of different bases and tables. They were edited by different people with different standards, though some field names were shared – so tables might have been "Quantities in weight" or "Quantities in Weight". I wonder if that has something to do with it?

Or is there some delay in Airtable updating its data after a change has been made? Is this a cache issue somewhere? I feel like I'm at a loss as to how to get this to work correctly.

@dbvisel
Copy link
Author

dbvisel commented Jul 29, 2021

Hi! I think talking this out actually solved my problem for me, though maybe this is an issue other people might run into.

What happened, it turned out, was that in one table "Quantities by Weight" was set up as a number, while in another table, "Quantities by Weight" was set up as plain text. What ends up happening is that "Quantities by Weight" just doesn't get pulled into the schema at all. I changed them both to plain text, and it works fine.

Maybe it would be nice to throw up a warning message if this kind of type mismatch happens?

Thanks for this plugin, by the way!

@dbvisel dbvisel changed the title field names vanish from schema Field type mismatch in Airtable means field doesn't show up at all in Gatsby Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant