You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm migrating over to @sanity/codegen from the old sanity-codegen package, but I'm stuggling to generate code for my groq queries. I'm getting syntax errors in all but 1 query. I initially thought it was caused by imported query fragments like this:
But the syntax errors doesn't appear only there, I also get them places like this. The code is based on the https://www.sanity.io/templates/akva-hydrogen-sanity-demo template, so I'd assume most of it is idiomatic groq. The code works fine in the app itself, so I'm unsure if the error messages are accurate. Maybe there's something that happens when the fragments are concatenated?
I have created a repro repository: here
Just run npm i && npm run codegen to see the errors.
Expected behavior
I expect the codegen to run without errors, or at least a better / more descriptive error message.
"Syntax error in GROQ query at position 158". Is that character 158 in the query? Even when glancing at those positions in the queries I have, I see nothing that looks like invalid syntax.
Which versions of Sanity are you using?
@sanity/cli 3.52.2 (up to date)
@sanity/codegen 3.52.2 (up to date)
sanity 3.52.2 (up to date)
What operating system are you using?
MacOS Sonoma 14.5 (23F79)
Which versions of Node.js / npm are you running?
10.8.1
v20.16.0
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm migrating over to @sanity/codegen from the old sanity-codegen package, but I'm stuggling to generate code for my groq queries. I'm getting syntax errors in all but 1 query. I initially thought it was caused by imported query fragments like this:
But the syntax errors doesn't appear only there, I also get them places like this. The code is based on the https://www.sanity.io/templates/akva-hydrogen-sanity-demo template, so I'd assume most of it is idiomatic groq. The code works fine in the app itself, so I'm unsure if the error messages are accurate. Maybe there's something that happens when the fragments are concatenated?
To Reproduce
I have created a repro repository: here
Just run
npm i && npm run codegen
to see the errors.Expected behavior
I expect the codegen to run without errors, or at least a better / more descriptive error message.
"Syntax error in GROQ query at position 158". Is that character 158 in the query? Even when glancing at those positions in the queries I have, I see nothing that looks like invalid syntax.
Which versions of Sanity are you using?
What operating system are you using?
MacOS Sonoma 14.5 (23F79)
Which versions of Node.js / npm are you running?
The text was updated successfully, but these errors were encountered: