Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Socket closed error #53

Open
jdchmiel opened this issue Oct 2, 2019 · 0 comments
Open

Question: Socket closed error #53

jdchmiel opened this issue Oct 2, 2019 · 0 comments

Comments

@jdchmiel
Copy link

jdchmiel commented Oct 2, 2019

I have a graphQl Lambda using serverless-mysql with mysql2. I am very rarely getting a lambda in a bad state where it cannot reconnect to the db. The sequence of errors is as follows:

ERROR { Error: This socket has been ended by the other party
at TLSSocket.writeAfterFIN [as write] (net.js:395:12)
INFO { [Error: Context creation failed: This socket has been ended by the other party]
message:
'Context creation failed: This socket has been ended by the other party',
locations: undefined,
path: undefined,
extensions:
{ code: 'INTERNAL_SERVER_ERROR',
exception: { stacktrace: [Array] } } }
ERROR { Error: Can't add new command when connection is in closed state

and then the INFO and ERROR repeat for each attempt from the browser to post to the Lambda in question.

In order to try and reproduce this, In some test code I have set the db timeout to 2 seconds and find it reconnects as expected. I have tried passing wrong user, but it fails immediately as expected and no further attempts on the connection occur with the thrown exception.

Has anyone else come across this closed socket issue and worked around it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant