Open WJKwok opened 8 months ago
I'm facing this same issue with a vanilla schema + DynamoDB data source + Cognito User Pool authentication. I leave the default schema on a new API untouched and add a JavaScript resolver to one of my subscriptions (while adding the necessary @aws_cognito_user_pools annotation to the necessary schema types). I get the same Runtime Error when trying to test the subscription in the console. The same error occurs whether with the generated Resolver JS code from the console or when I replace it with the example code outlined in the documentation:
https://docs.aws.amazon.com/appsync/latest/devguide/aws-appsync-real-time-enhanced-filtering.html
For me it worked once I moved the subscription resolver from the DynamoDB datasource to the NONE datasource.
What i'm trying to achieve: custom javascript resolver for a subscription.
I understand that when you use appsync and create a type for e.g.
type chatMessage { channel: String! userId: String! text: String! id: ID! }
appsync will automatically generate queries, mutations and subscriptions for you. And they work, even though the auto-generated subscriptions all don't seem to have a resolver. Why is that so?
When i try to attach a custom javascript resolver on
onCreateChatMessage
, it failed with"Connection failed: {\"errors\":[{\"errorType\":\"Code\",\"message\":\"Runtime Error\"}]}"
.I tried creating a new subscription, and attached the resolver to it, but it failed too.
The resolver i added was based on the appsync doc
What am i doing wrong? The logs are not showing any errors either :/