Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom subscription resolver: connection failed, runtime error #355

Open
WJKwok opened this issue Mar 15, 2024 · 2 comments
Open

custom subscription resolver: connection failed, runtime error #355

WJKwok opened this issue Mar 15, 2024 · 2 comments

Comments

@WJKwok
Copy link

WJKwok commented Mar 15, 2024

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?

Screenshot 2024-03-15 at 22 07 21

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

Screenshot 2024-03-15 at 22 14 26 Screenshot 2024-03-15 at 22 16 57

What am i doing wrong? The logs are not showing any errors either :/

@cjcatchings
Copy link

cjcatchings commented Apr 4, 2024

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

@HaaLeo
Copy link

HaaLeo commented Jun 26, 2024

For me it worked once I moved the subscription resolver from the DynamoDB datasource to the NONE datasource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants