Thursday, September 27, 2018

[google-cloud-sql-discuss] Re: Fails to connect to Cloud SQL when using Knex.js (direct driver works fine)

Is the function returning this error consistently? As per this documentation regarding connecting to Cloud SQL in Cloud Functions, connections to the database might be dropped by the infrastructure underlying Cloud Functions, so you will need to use a library that supports automatically reconnecting broken connections. Also you need to make sure you are setting maximum concurrent connections to 1 since Cloud Functions limits it to 1.

I did some research regarding re-connection using knex specifically, I suggest looking into this issue thread, which discusses reconnecting after a server disconnect. It might be the reason the connection keeps dropping in your case.

It is recommended to post development related questions on Stackoverflow as they will get more visibility. Groups is better suited for general discussion questions.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/ad38625f-8564-4bb9-a142-1e1a33d4f6ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment