I’m working with gatsby-source-airtable to fetch photos from an Airtable database. I’ve set up the filenode mapping in my gatsby-config file like this:
mapping: {'photo': 'fileNode'}
When I test in GraphiQL, everything works fine. This query runs successfully:
{
airtable(table: {
eq: "products"
}, data: {
name: {
eq: "sample-item"
}
}) {
data {
photo {
localFiles {
childImageSharp {
fluid(maxWidth: 300) {
src
}
}
}
}
}
}
}
And returns:
{
"data": {
"airtable": {
"data": {
"photo": {
"localFiles": [{
"childImageSharp": {
"fluid": {
"src": "/static/abc123def456-image-processed.jpg"
}
}
}]
}
}
}
}
}
But when I try to use this data with the Gatsby Image component:
<Img fluid={item.data.photo.localFiles.childImageSharp.fluid} />
export const pageQuery = graphql`
query ItemQuery {
airtable(table: {
eq: "products"
}, data: {
name: {
eq: "sample-item"
}
}) {
data {
photo {
localFiles {
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
`
I get this error: TypeError: Cannot read property 'fluid' of undefined
What could be causing this issue? Any help would be great!