title: AWS AppSync - Error during subscription handshake
body: <p>When I have not resolver for subscription I dont have any problem with subscription but when I set the resolver to allow only specific users, in my angular App I have this error</p>
  
  <blockquote>
    <p>appsync.service.ts:187 Error: Error during subscription handshake
        at new ApolloError (ApolloError.js:37)
        at subscription-handshake-link.js:116
        at new Subscription (Observable.js:183)
        at Observable.subscribe (Observable.js:262)
        at index.js:20
        at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke
    (zone.js:388)
        at Object.onInvoke (core.js:3820)
        at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke
    (zone.js:387)
        at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:138)
        at zone.js:872</p>
  </blockquote>
  
  <p><strong>Resolver</strong></p>
  
  <p><strong>Data source type</strong>: NONE</p>
  
  <p><strong>Configure the request mapping template.</strong></p>
  
  <pre><code>#set ($a= $context.identity.cognitoIdentityAuthProvider.split(":"))
  #set ($s= $a.get(2))
  #set ($stringLength = $s.length() - 1) 
  #set ($sub = $s.substring(0,$stringLength))
  
  
  {
      "version": "2017-02-28",
      "payload": {
          "from": "$sub",
          "id":"${context.arguments.id}"
      }
  }
  </code></pre>
  
  <p><strong>Configure the response mapping template.</strong></p>
  
  <pre><code>#if(${context.arguments.id} == ${context.result.from})
      $util.toJson($context.result)
  #else
      $utils.unauthorized()
  #end
  </code></pre>
  
  <p>Only for simplify, I tried this resolver response but I had same error</p>
  
  <pre><code>$util.toJson($context.result)
  </code></pre>