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

10.6 api gql-compile reports error in schema comments when it finds any of the ')]}' characters #1143

Closed
2 tasks done
vgribok opened this issue Jan 6, 2023 · 4 comments
Closed
2 tasks done

Comments

@vgribok
Copy link

vgribok commented Jan 6, 2023

How did you install the Amplify CLI?

npm

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

18.3.0

Amplify CLI Version

10.6

What operating system are you using?

MacOS

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

No

Describe the bug

After upgrading CLI from 10.5.x to 10.6 most amplify started complaining on my API graphql schema, reporting errors like "Syntax Error: mismatched brackets found in the schema. Unexpected ]". Other characters it didn't like were ) and }. All of these places were in commented out parts of the schema and had no problem before 10.6.

Expected behavior

Ignore ),],} chars in comments as pre 10.6 cli did.

Reproduction steps

  1. Use amplify 10.6.
  2. Add a comment to the api .graphql file and put one of the ),],} chars to the comment.
  3. Run amplify api gql-compile, see errors.

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • 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.
@josefaidt josefaidt transferred this issue from aws-amplify/amplify-cli Jan 6, 2023
@ggcespia
Copy link

ggcespia commented Jan 7, 2023

This happens as of yesterday on [email protected] as well, so it must be a component that is called.

 # Executing command: npm i -g @aws-amplify/[email protected]
2023-01-07T01:57:56.983Z [INFO]: 🛑 Syntax Error: mismatched brackets found in the schema. Unexpected ] at line 7 in the schema.

schema shows this in comments (you'll see square brackets on line 7):

# This "input" configures a global authorization rule to enable public access to
# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/cli/graphql/authorization-rules
#input AMPLIFY { globalAuthRule: AuthRule = { allow: public } } # FOR TESTING ONLY!

# "group" groupsField is an attribute in cognito? like (email, etc.?)
#type Projects @model @auth(rules: [
#   {allow: groups, groups: ["Admins"] },
#   {allow: groups, groups: ["Readers"], operations: [read]}
#  ]) 
#  {
#  id: ID!
#  title: String
#}

@AnilMaktala AnilMaktala added the bug Something isn't working label Jan 9, 2023
@AnilMaktala
Copy link
Member

Hi @vgribok @ggcespia, Thank you for reporting the issue. We can reproduce this issue and marked this as a bug for the team to evaluate further.

image

@alharris-at
Copy link
Contributor

We have a draft PR that should be able to address this, but will require additional testing and refactoring before we can accept it. #1138

@alharris-at
Copy link
Contributor

This bracket check has been removed in Amplify CLI v10.6.2, and upgrading to the latest version should resolve the issue you're running into. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants