Skip to content

Syntax error with GraphQL validation #107

@undefobj

Description

@undefobj

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

No response

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

7.6.21

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Amplify Categories

api

Amplify Commands

Not applicable

Describe the bug

When you have a syntax error on a directive we get a stack trace. Example:

type Todo @model @auth(rules: [{ allow: owner }] {
  id: ID!
  name: String!
  description: String
}

Notice that a closing ) is missing. If I run amplify-dev api gql-compile I get the following:

clitestproj $amplify-dev api gql-compile
🛑 Syntax Error: Expected Name, found {
GraphQLError: Syntax Error: Expected Name, found {
    at syntaxError (.../amplify-cli/node_modules/graphql/error/syntaxError.js:15:10)

Expected behavior

Something friendly telling me what the error in the syntax is or at least something like "hey fix your syntax you might be missing a closing brace or something"

Reproduction steps

Run compile with a syntax error

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line


Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions