-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix for MySQL Pooling Async Bug #1710
Copy link
Copy link
Closed
Labels
api: cloudsqlIssues related to the Cloud SQL for MySQL API.Issues related to the Cloud SQL for MySQL API.type: docsImprovement to the documentation for an API.Improvement to the documentation for an API.
Description
Activity
Metadata
Metadata
Assignees
Labels
api: cloudsqlIssues related to the Cloud SQL for MySQL API.Issues related to the Cloud SQL for MySQL API.type: docsImprovement to the documentation for an API.Improvement to the documentation for an API.
The NodeJS MySQL server.js code has an async Pool creation call createPool() without any await. So when it is immediately followed by ensureSchema() which runs a query on the pool, it throws an error as the pool isn't yet created:
This is the same example on Google Cloud Docs and I assumed them to be correct and wasted 2 days on this thinking something wrong at my end. Please fix this so even any other call can ensure that pool object is properly created before call.
Link to code:
https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/cloud-sql/mysql/mysql/server.js