redwoodjs/learn.redwoodjs.com

An Issue I spotted regarding Cells tutorial

berkerdemirer opened this issue · 6 comments

Hello,

It could be that I made a mistake but I just wanted to point it out anyway. While following the tutorial I encountered an issue with the Cell that I created for blog posts. Although I changed the query type to posts as suggested in the tutorial and as it is like that in the GraphQL schema, I am still getting an error like Cannot query field "posts" on type "Query".GraphQL: Validation and returned result is empty.

This is the type I have in posts.sdl.js
type Query { posts: [Post!]! @requireAuth post(id: Int!): Post @requireAuth }

and query in the cell

query BlogPostsQuery { posts { id } }

https://learn.redwoodjs.com/docs/tutorial/cells

Edit: I realised that this issue persist in all the graphql related files

@cannikin have you run into this issue before?

Hmm I have not. Are those code samples you pasted what’s actually in your code? Are there no newlines in those queries? I think they’re required inside to delineate certain parts.

If there ARE newlines, maybe try restarting the dev server @berkerdemirer?

Hey @berkerdemirer were you able to get this working? No pressure, but I'm just going through and cleaning up issues and would like to close this if it's resolved. :)

I just ran into the same issue, I think VS Code has some issues updating types dynamically, restarting VS Code made that error disappear

We've heard something similar from a core team member—sometimes VS Code just needs a restart, or at least the typescript engine in order to pick up new types. I believe we're working on a fix.

I'm going to close this one, but feel free to re-open if you've got new information that this is specific to the tutorial.

I just encountered this same issue, restarting vscode fixed it as well.