6

I am trying to upload my graphql schema to aws appsync. My graphql schema is nearly 5000 lines long. I tried uploading using cli and gui, both.

(1.) When using cli, I am continually getting error "Failed to parse schema document - ensure it's a valid SDL-formatted document."

(2.) When using gui, the pipes in all the unions in my graphql schema ( eg. union UnionType = Type1 | Type2 | Type3 ) are replaced with whitespaces, causing syntax error. After solving this by manual replacement of whitespaces, the tab becomes unresponsive, and needs to be killed.

I tried uploading a small graphql schema with a union from cli, and it worked successfully. However, from gui, it caused the same error of replacing pipes with whitespaces in union.

I need help understanding this behaviour with aws cli and aws console.

Tapan Halani
  • 334
  • 1
  • 3
  • 11
  • How big is your schema? – Karthik Mar 19 '18 at 22:14
  • In terms of file size, 134KB. In terms of number of lines, upwards of 5600 lines. – Tapan Halani Mar 20 '18 at 06:01
  • As to point 1, that's the 'catch all' message for a schema that the service couldn't parse. Could you share a request id, relative timestamp, and region in which you called? I can investigate further. – Jeff Bailey Apr 11 '18 at 23:10
  • Same issue here. Any solution ? –  May 22 '18 at 09:16
  • We finally ended up using https://github.com/sid88in/serverless-appsync-plugin , as it provided us with the flexibility of adding our graphql resolvers and everything inside the serverless.yaml file. This simplified our build process, as we are anyways using serverless – Tapan Halani May 28 '18 at 15:08

2 Answers2

2

I've got a similar issue and AppSync didn't allow to put any comments in it with just only one # symbol.

Make sure you have no comments with just one # and use double sharps ## Anyway, it happens you have some invalid format or syntax AppSync doesn't support yet.

harley
  • 396
  • 1
  • 8
  • 1
    This was similar for me – I commented my `enum` & it rejected it. Without comments in the enum, it was 100%. – LordParsley Jun 29 '22 at 08:54
  • I had sort of a combination of these two issues: comments starting with `#` inside of an `enum` were rejected, but comments starting with `##` were simply ignored (they are not visible in the console editor). – Kyle Strand Mar 27 '23 at 22:45
1

It turns out that, in our case, the problem was the existence of reserved keys defined in out schema (DynamoDB reserved words) even though we are not using Dynamo at all.

bitIO
  • 384
  • 3
  • 11
  • Does Query count? I see the word QUERY in the reserved list, but the docs use type Query https://docs.aws.amazon.com/cdk/api/latest/docs/aws-appsync-readme.html. – 55 Cancri May 02 '20 at 01:41