GraphQL -> RDS (Aurora Serverless v1, mysql, DataAPI): Connection Errors

0

I'm seeing frequent connection errors and wondering if others have encountered this and/or know of workarounds.

Details:
Error Message: "Got an error reading communication packets".
How it's produced: const response = await API.graphql(graphqlOperation(upsertUser, { user: { ...etc... }}));
Frequency: Nearly every other request.

Tech stack:
Frontend: Amplify, React
Backend: AppSync: GraphQL API, RDS (Aurora Serverless v1, MySql, DataApi enabled, ACU Min=1, Max=4)
All components were created in the week of July 20, 2021 so they should be sufficiently updated.

Additional Context:
My research so far make me suspect the database connections are being depleted despite the fact that I'm the only user on this application and Aurora DataAPI supposedly does connection pooling. I can trigger the problem with 1 user running 2 queries a few seconds apart so there's zero chance to scale this until I can get around this issue. I'm considering adding RDS Proxy but that seems redundant with DataAPI... Help would really be appreciated here.

What the app is doing: The react app loads an object from the database via graphQL -> stored procedure, then displays the object fields, then allows the user to save any changes to those fields via graphQL -> stored procedure. This sequence works for the first modify but the next modify triggers a connection error. The inputs that triggered the connection error are valid as I'm able to save to the database without error when the page reloads and I send the same inputs.

CloudWatch logs for my aurora db cluster sometimes show a statement like this but it seems not every error is logged:
2021-07-27T23:46:40.922336Z 101 [Note] Aborted connection 101 to db: '<DB NAME>' user: 'admin' host: '1.2.3.4' (Got an error reading communication packets)

I have not seen any other helpful logs.

ebar1
asked 3 years ago402 views
1 Answer
0

I was able to solve my issue by changing the way the application was rendering content. Seems there was a bad sequence of asynchronous React events which leading to the graphql request being affected. The problem has not happened in a day so I can't say exactly what fixed it but all the changes have been in the frontend of the app since then.

ebar1
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions