project_graphql_blog
project_graphql_blog copied to clipboard
Error: input:1: Field "post" is not defined by type CommentWhereInput. Did you mean NOT?
Unhandled Runtime Error Error: input:1: Field "post" is not defined by type CommentWhereInput. Did you mean NOT? : {"response":{"errors":[{"message":"input:1: Field "post" is not defined by type CommentWhereInput. Did you mean NOT?\n"}],"data":null,"extensions":{"requestId":"ckxry0cko0slc0b793i100kyf"},"status":400,"headers":{"map":{"cache-control":"private, no-store","content-length":"179","content-type":"application/json"}}},"request":{"query":"\n query GetComments($slug:String!) {\n comments(where: {post: {slug:$slug}}){\n name\n createdAt\n comment\n }\n }\n ","variables":{"slug":"goalofthisblogconstructionfoundations"}}}
Source
.next\static\chunks\pages_app.js (254:0) @
252 | else { 253 | errorResult = typeof result === 'string' ? { error: result } : result;
254 | throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables }); 255 | } 256 | return [2 /return/]; 257 | }
By clicking on a post this error pops up. It appears to be referring to the where clause in GetComments graphql query. Submiting comments also do not work.
Solution is to give API access. Around 2:44:00 in tutorial video.
@Norman-Potts you can use comments(where: {slug:$slug}) and update me if you get any errors.