ChilliCream / ChilliCream/graphql-platform

Starting a Subscription to AWS AppSync with AWS Cognito User Pool Authorization

Open
#6,468 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake Area: Subscriptions
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is there an existing issue for this?
  • I have searched the existing issues
Product

Strawberry Shake

Describe the bug

I am using StrawberryShake.Blazor v13.4.0 as a client to an AWS AppSync GraphqlApi. Query components work and a subscription component is making a successful connection with AWS Cognito User Pool authorization, but the subscription “start” causes an UnsupportedOperation error.

This is the network log from my web browser.

{"type":"connection_init"}
{"type":"start","id":"c0931a4a-04f3-4c2b-8cde-ddbe6f4ff20b","payload":{"query":"subscription OnCreateAsset { onCreateAsset { __typename _deleted _version dateCreated dateModified id name } }","operationName":"OnCreateAsset"}}
{"type":"connection_ack","payload":{"connectionTimeoutMs":300000}}
{"type":"ka"}
{"type":"error","payload":{"errors":[{"errorType":"UnsupportedOperation","message":"unknown not supported through the realtime channel"}]}}

I know from a test in Postman that if I could configure my StrawberryShake WebSocket client to use the following format for a subscription “start” instead of the current format, the subscription registration would be successful.

{
    "type": "start",
    "id": "e6122ade-39a9-491c-ad57-09d9283324ea",
    "payload": {
        "data": "{\"query\":\"subscription OnCreateAsset { onCreateAsset { __typename _deleted _version dateCreated dateModified id name } }\"}",
        "extensions": {
            "authorization": {
                "Authorization": "jwt.jwt.jwt",
                "host": "abcdefghijklmnopqrstuvwxyz.appsync-api.us-east-1.amazonaws.com"
            }
        }
    }
}

AWS documentation for the subscription registration message format: https://docs.aws.amazon.com/appsync/latest/devguide/real-time-websocket-client.html#subscription-registration-message
AWS blog post for creating a Python client with real-time subscriptions : https://aws.amazon.com/blogs/mobile/appsync-websockets-python/

How do I configure my StrawberryShake WebSocket client to use the AWS AppSync graphql-ws protocol format?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start at Strawberry Shake's WebSocket subscription registration entry point and compare its start message with the AWS AppSync subscription-registration documentation and the provided network payload. Done means the client can register this Cognito-authorized subscription successfully using the required AppSync format.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
api, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.