Gatsby: Cannot filter by 'id' in GraphQL queries

Created on 19 Sep 2018  路  4Comments  路  Source: gatsbyjs/gatsby

Description

I think that both example1 and example2 should produce the same output:

image

There is something funny going on with the id field, for example, when I try ne instead of eq, I get an error:

image

Steps to reproduce

Sorry, I don't have a small repro, first wanted to ask whether I'm not doing anything stupid. The nodes are generated from a custom plugin that fetches images from remote URLs.

If this indeed looks like a bug, I'll prepare a small repro repo.

Environment

System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Shell: 5.6.2 - /usr/local/bin/zsh
Binaries:
Node: 10.10.0 - ~/.nvs/default/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvs/default/bin/npm
Browsers:
Chrome: 69.0.3497.100
Safari: 12.0
npmPackages:
gatsby: ^2.0.2 => 2.0.2
gatsby-image: ^2.0.5 => 2.0.5
gatsby-plugin-google-tagmanager: ^2.0.5 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-plugin-sharp: ^2.0.5 => 2.0.5
gatsby-plugin-typescript: ^2.0.0 => 2.0.0
gatsby-source-filesystem: ^2.0.1 => 2.0.1
gatsby-transformer-json: ^2.1.1 => 2.1.1
gatsby-transformer-remark: ^2.1.3 => 2.1.3
gatsby-transformer-sharp: ^2.1.1 => 2.1.1

confirmed bug

All 4 comments

We shouldn't throw error there and this query should complete without error, so surely a bug and I can reproduce it in here: https://gatsbygraphql.sloppy.zone/?query=%7B%0A%20%20allFile(limit%3A%2010%2C%20filter%3A%20%7Bid%3A%20%7Bne%3A%20%22test%22%7D%7D)%20%7B%0A%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A

I'm also seeing this with gatsby-transform-json, when attempting to filter data from json files by filter: {id:{eq:"..."}}

changed "id" key to "uid" in my JSON files and everything works now
id seems to be a reserved keyword

thanks to @ghardin137 for the suggestion on the discord channel

Opened PR with fix: #9101

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TuckerWhitehouse picture TuckerWhitehouse  路  69Comments

freiksenet picture freiksenet  路  131Comments

blainekasten picture blainekasten  路  130Comments

kuworking picture kuworking  路  115Comments

jonathan-chin picture jonathan-chin  路  69Comments