AWS AppSync Subscription to Mutation with object as input struggle

AWS AppSync Subscription to Mutation with object as input struggle


0

I want to create an EventBridge Rule that should trigger a a GraphQL Subscription over Appsync. Everything worked fine until I changed Service from an object to a string.

My GraphQL Schema looks like this:

input nestedObjectInput {
    A: String
    B: String
}

type simpleReturn {
    Name: String
    Service: nestedObject
}

type Mutation {
    simpleMut(Name: String, Service: nestedObjectInput!): simpleReturn 
}
    
type Subscription {
    onSimpleMut: simpleReturn
        @aws_subscribe(mutations: ["simpleMut"])
}

In the Appsync Service my subscription works fine with this Mutation syntax:

    mutation MyMutation {
      simpleMut(Service: {A: "aaa", B: "bbb"}, Name: "123") {
        IMSI
        Service {
          A
          B
        }
      }
    }

Now the fun part starts… I want this mutation to be triggered over an EventBridge Rule. So I need to configure an input transformer.

My Target Input Transformer looks like this:

    {
      "A": "$.detail.Service.A",
      "B": "$.detail.Service.B",
      "Name": "$.detail.Name",
      "Service": "$.detail.Service"
    }

Any my input Template looks like this:

        {
      "query": "mutation SimpleMut($Name: String, $Service: {$A: String, $B: String}) { simpleMut(Name:$Name, Service: {A: $A, B: $B}) { Name Service{A B}}}",
      "operationName": "SimpleMut",
      "variables": {
        "Name": "<Name>",
        "Service": "<Service>",
        "A": "<A>",
        "B": "<B>"
      }
    }

If I run this example Event:

    {
      "metaData": "secretStuff", 
      "detail": {
        "Name": "123",
        "Service": {
          "A": "aaa",
          "B": "bbb"
        }
      }
    }

And get this promising looking output:

    {
      "query": "mutation SimpleMut($Name: String, $Service: {$A: String, $B: String}) { simpleMut(Name: $Name, Service: {A: $A, B: $B}) { Name Service{A B}}}",
      "operationName": "SimpleMut",
      "variables": {
        "Name": "123",
        "Service": "[object Object]",
        "A": "aaa",
        "B": "bbb"
      }
    }

But I receive nothing on my GraphlQL Subscription. I have put a lambda in parallel to the endpoint where I receive the Event in the expected format. The API Destination can’t be the problem because it’s working if Service is a simple String.

Any suggestions??

Or how can I debug this since I don’t get any error message to understand what’s going wrong

Edit1: Format, additional Q


Load 4 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *