project_graphql_blog icon indicating copy to clipboard operation
project_graphql_blog copied to clipboard

Error: input:1: Field "post" is not defined by type CommentWhereInput. Did you mean NOT?

Open Norman-Potts opened this issue 2 years ago • 2 comments

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.

Norman-Potts avatar Dec 29 '21 19:12 Norman-Potts

Solution is to give API access. Around 2:44:00 in tutorial video.

Norman-Potts avatar Dec 29 '21 19:12 Norman-Potts

@Norman-Potts you can use comments(where: {slug:$slug}) and update me if you get any errors.

ritikranjan12 avatar May 14 '22 12:05 ritikranjan12