EDIT: now with working code below
I have this query to fetch a gatsby-image:
query getImages($fileName: String) {
la
The two answers (from Bens and Nimish) are wrong in this context, they're not specific to Gatsby.
If you want to use variables in the GraphQL queries, you have to pass them via context in the createPage function in gatsby-node.js as explained here:
https://www.gatsbyjs.org/docs/programmatically-create-pages-from-data/
You currently can't use variables outside of that, e.g. have a look at this discussion: https://spectrum.chat/?t=abee4d1d-6bc4-4202-afb2-38326d91bd05