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

Incomprehensive Error Message when using @list in a query and type not defined #478

Closed
kuihlein opened this issue Aug 25, 2022 · 1 comment

Comments

@kuihlein
Copy link

Describe the bug

I had a table and a matching query (external file) and everything worked fine. I deleted the table (in hasura) and forgot to remove the matching query, when running houdini again I got the following error, which I couldn't assign to any file or code changes.

Query with @list:

query Organisations {
   Organisation @list(name:"All_Organisations"){
        id
        name
        abbreviation
        legalForm
    }
}

Error Message for query with @list:

> [email protected] generate
> houdini generate -v -p -ph x-hasura-admin-secret=blablabla

🎩 Generating runtime...
❌ Cannot read properties of undefined (reading 'type')
    at Object.Directive (file:///home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/houdini/build/cmd.js:73751:72)
    at Module.visit (/home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/graphql/language/visitor.js:243:26)
    at typeCheck (file:///home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/houdini/build/cmd.js:73679:17)
    at runPipeline$1 (file:///home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/houdini/build/cmd.js:5544:15)
    at runPipeline (file:///home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/houdini/build/cmd.js:74421:11)
    at async compile (file:///home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/houdini/build/cmd.js:74388:5)
    at async Command.<anonymous> (file:///home/kasimir/Downloads/serverdocumentation/uis/example_ui_one/node_modules/houdini/build/cmd.js:116022:9)

After a while, I discovered by coincidence that I have a query that I don't need anymore and deleted it. It then worked again. Further investigation revealed that the error is displayed directly if you do not use @list in your query.

Query wihtout @list:

query Organisations {
   Organisation {
        id
        name
        abbreviation
        legalForm
    }
}

Error Message for query without @list:

> [email protected] generate
> houdini generate -v -p -ph x-hasura-admin-secret=blablabla

🎩 Generating runtime...
❌ Encountered error in src/graphql/Organisations.graphql
Cannot query field "Organisation" on type "query_root". Did you mean "Translation"?

Severity

annoyance

Steps to Reproduce the Bug

  1. Create a query in an external file without a matching type (in my case without a matching table in hasura) and use @list
  2. run houdini generate -v -p -ph x-hasura-admin-secret=blablabla
  3. Read the unprecise/incomplete error message
  4. Create a query in an external file without a matching type (in my case without a matching table in hasura) and not use @list
  5. run houdini generate -v -p -ph x-hasura-admin-secret=blablabla
  6. Read the precise error message including the note to the problematic file

Expected behavior

I expect the same error message, or reference to the incorrect file, as when I do not use @list in the query.

System Info

houdini: ^0.15.8 (and ^0.15.9)
hasura: v2.5.1

Reproduction

No response

Additional context

No response

AlecAivazis pushed a commit that referenced this issue Aug 25, 2022
* 🚸 IMPROVE: Message when @list directive and type error in schema (#478)

* ✏️ NEW: changeset
@AlecAivazis
Copy link
Collaborator

This is now fixed in 0.16.0-next.2

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

2 participants