aws / aws/aws-appsync-community

AppSync subscription silently fails due to too large of an update mutation

Open
#33 11 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

NOTE: The mutation does indeed work, however, the response payload is greater than 128kb. From what I've been told, 128kb exceeds the limit of AppSync subscriptions. It'd be nice if the error callback/handler were called with this information thogh.
ANOTHER NOTE: "codegen" refers to an amplify-cli tool, I moved this issue from there.

**Describe the bug**
Although I'm a bit ashamed to admit how I ran into this lol I suppose it'll be helpful for others in the future.

I've been building an MVP for the past few months as fast as I can, and because of my hastiness, I'm using codegen'd statements with a maximum depth of 5 (I plan on writing my queries/mutations with the exact required fields, later). At some point I realized that a subscription for one of my models was not triggering whatsoever; no errors, nada.

I looked into race conditions, compared the generated statements line by line, and couldn't figure it out until I went to the AppSync console and "dumbed down" the mutation and respective subscription. The subscription triggered, phew. I had a few more suspicions but eventually tried reducing my codegen'd statements in max-depth (to 2). This worked.

**To Reproduce**
There are many ways to repro this bug, I believe what matters is that you codegen a mutation that is similar in size, depth, etc. to the one below.

**Smartphone (please complete the following information):**
- Device: iPhone XR
- OS: iOS 12.3

**Additional context**
I assume most people don't codegen with a max-depth of 5, so this probably isn't high priority. I'm leaving this issue for others that may run into this bug.

**Sample code**
The mutation that I believe is too large to trigger a subscription.
(Note: The subscription, with the exact same size and attributes as below, works as is. It appears to strictly be the mutation size which matters.)
```
mutation UpdateIdentity($input: UpdateIdentityInput!) {
updateIdentity(input: $input) {
id
createdAt
updatedAt
stripeAccountId
type
deactivatedAt
profilePicture {
bucket
key
region
}
firstName
lastName
biography
balance
personalOrderList {
items {
id
createdAt
updatedAt
stripeChargeId
meal {
id
createdAt
updatedAt
cookIdentity {
id
createdAt
updatedAt
stripeAccountId
type
deactivatedAt
firstName
lastName
biography
balance
placeNameHistory
}
orderList {
nextToken
}
pricePerServing
currency
name
description
pickupAt
pickupDelayedBy
keywords
numServings
pickupPlaceName
pickupInstructions
images {
bucket
key
region
}
}
customerIdentity {
id
createdAt
updatedAt
stripeAccountId
type
deactivatedAt
profilePicture {
bucket
key
region
}
firstName
lastName
biography
balance
personalOrderList {
nextToken
}
mealList {
nextToken
}
placeNameHistory
}
cookIdentity {
id
createdAt
updatedAt
stripeAccountId
type
deactivatedAt
profilePicture {
bucket
key
region
}
firstName
lastName
biography
balance
personalOrderList {
nextToken
}
mealList {
nextToken
}
placeNameHistory
}
cancelledAt
cancelledBy
cancellationReason
cookCompletedAt
customerCompletedAt
numServings
notes
review
rating
tip
}
nextToken
}
mealList {
items {
id
createdAt
updatedAt
cookIdentity {
id
createdAt
updatedAt
stripeAccountId
type
deactivatedAt
profilePicture {
bucket
key
region
}
firstName
lastName
biography
balance
personalOrderList {
nextToken
}
mealList {
nextToken
}
placeNameHistory
}
orderList {
items {
id
createdAt
updatedAt
stripeChargeId
cancelledAt
cancelledBy
cancellationReason
cookCompletedAt
customerCompletedAt
numServings
notes
review
rating
tip
}
nextToken
}
pricePerServing
currency
name
description
pickupAt
pickupDelayedBy
keywords
numServings
pickupPlaceName
pickupInstructions
images {
bucket
key
region
}
}
nextToken
}
placeNameHistory
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the sample UpdateIdentity mutation and subscription with codegen max-depth 5, then compare the behavior at max-depth 2 and in the AppSync console. Trace the subscription error callback or handler and determine whether the oversized response can be surfaced; done means this failure is reported instead of silently ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.