awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
921 stars 266 forks source link

Data Validation Error when using Appsync Console to test queries #554

Closed zacharykapank closed 4 years ago

zacharykapank commented 4 years ago

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? a bug I guess.

When testing a mutation that takes one input of type AWSJSON,

I've tested it using the below code:

  sendEmail(data: {
  template: "EMAIL_TEMPLATE",
  recipient: "email@address",
  data: {
    name: "name",
    time: "time",
    date: "date",
    location: "location"
  }
})

Which gave the following error:

{
  "data": null,
  "errors": [
    {
      "path": null,
      "locations": [
        {
          "line": 31,
          "column": 13,
          "sourceName": null
        }
      ],
      "message": "Validation error of type WrongType: argument 'data' with value 'ObjectValue{objectFields=[ObjectField{name='upvotes', value=IntValue{value=10}}]}' is not a valid 'AWSJSON' @ 'sendEmail'"
    }
  ]
}

What is the current behavior?

Currently, I can't find clear instructions on how to enter a data of type AWSJSON within the AppSync console while testing mutations. The only object type it doesn't throw a syntax error for it throws a validation error for.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior?

I've expected the mutation to be executed and the results to be returned as per my resolver.

**Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? AWS Console => AppSync => Queries

elorzafe commented 4 years ago

@TheSilentDev thanks for your feedback, this repo is related to AppSync SDK JS issues, for issues with AppSync Service, AppSync Console can you please create the issue on this repo.