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
질문됨 3년 전310회 조회
1개 답변
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
답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인