Thursday, September 8, 2016

[google-cloud-sql-discuss] Re: #nodejs #2ndGen Error: connect ETIMEDOUT

In fact, the original error comes from the first connection creation after the Node.js application starts: 

{ Error: Connection lost: The server closed the connection.
2016-09-08 15:32:39 default[20160908t164127]      at Protocol.end (/app/node_modules/mysql/lib/protocol/Protocol.js:109:13)
2016-09-08 15:32:39 default[20160908t164127]      at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:115:28)
2016-09-08 15:32:39 default[20160908t164127]      at emitNone (events.js:91:20)
2016-09-08 15:32:39 default[20160908t164127]      at Socket.emit (events.js:185:7)
2016-09-08 15:32:39 default[20160908t164127]      at endReadableNT (_stream_readable.js:974:12)
2016-09-08 15:32:39 default[20160908t164127]      at _combinedTickCallback (internal/process/next_tick.js:74:11)
2016-09-08 15:32:39 default[20160908t164127]      at process._tickCallback (internal/process/next_tick.js:98:9)
2016-09-08 15:32:39 default[20160908t164127]      --------------------
2016-09-08 15:32:39 default[20160908t164127]      at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:141:48)
2016-09-08 15:32:39 default[20160908t164127]      at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:52:41)
2016-09-08 15:32:39 default[20160908t164127]      at PoolConnection.connect (/app/node_modules/mysql/lib/Connection.js:136:18)
2016-09-08 15:32:39 default[20160908t164127]      at Pool.getConnection (/app/node_modules/mysql/lib/Pool.js:48:16)
2016-09-08 15:32:39 default[20160908t164127]      at Promise (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:205:27)
2016-09-08 15:32:39 default[20160908t164127]      at MysqlDriver.retrieveDatabaseConnection (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:204:20)
2016-09-08 15:32:39 default[20160908t164127]      at MysqlDriver.<anonymous> (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:101:51)
2016-09-08 15:32:39 default[20160908t164127]      at next (native)
2016-09-08 15:32:39 default[20160908t164127]      at /app/node_modules/typeorm/driver/mysql/MysqlDriver.js:7:65
2016-09-08 15:32:39 default[20160908t164127]      at __awaiter (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:3:12) fatal: true, code: 'PROTOCOL_CONNECTION_LOST' }



I also forgot to indicate that the different MySQL connection options:
  • locally (working)
    • host: <MySQL_instante_remote_IP_address>
    • port: 3306
    • username: root
    • password: <root_password>
    • database: <database_name>
  • on App Engine (not working)
    • host: localhost
    • port : 3306
    • username: root
    • password: <root_password>
    • database: <database_name>
    • socketPath: "/cloudsql/{projectName}:{zone}:{instance-name}"

On Thursday, September 8, 2016 at 3:41:27 PM UTC+2, Lekooa Dev wrote:
Hello!

I'm currently developing a Node.js application (Express framework and TypeORM) with MySQL Second Generation. 

When the Node.js application runs on a local machine, they are any problem to connect and use the MySQL instance. 

But when the Node.js application is deployed on the App Engine, I have this following error "Error: connect ETIMEDOUT" after each query.

Thanks for you help!

----

Dockerfile:
# Use the base App Engine Docker image, based on debian jessie.
FROM gcr
.io/google_appengine/nodejs
# Install specific node.js version
RUN install_node v6
.5.0
# Copy application code.
COPY
. /app/
WORKDIR
/app
# Set common env vars
ENV NODE_ENV dev
 
# Install dependencies.
RUN npm
--unsafe-perm install
# start
CMD
["npm", "start"]

app.yaml:
# [START app_yaml]
#runtime: nodejs
runtime
: custom
vm
: true
beta_settings
:
      cloud_sql_instances
: "<cloud-sql-instance-name>"
# [END app_yaml]

--
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/8f58667a-7ab1-4716-af80-89067f461349%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment