aws / aws/aws-appsync-community

custom subscription resolver: connection failed, runtime error

Open
#355 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

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 ](https://docs.aws.amazon.com/appsync/latest/devguide/aws-appsync-real-time-enhanced-filtering.html#aws-appsync-real-time-enhanced-filtering-defining-filters)

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 :/

Contributor guide

Open the contributing guide

Research direction

Start with the custom JavaScript resolver attached to onCreateChatMessage and compare it with the AWS AppSync enhanced-filtering example linked in the issue. Reproduce the connection failure, inspect the resolver and runtime logs, and confirm the subscription connects without a Runtime Error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.