Spencer Curry
06/23/2021, 3:49 PM"\nInvalid `prisma.objects.findMany()` invocation:\n\n\n Can't reach database server at `xx.xxx.xxx.xx`:`3306`\n\nPlease make sure your database server is running at `xx.xxx.xxx.xx`:`3306`."
On my local machine I am using DATABASE_URL="<mysql://username:password@xx.xxx.xxx.xx:3306/db_name?schema=public>"
but that connection string is clearly not working on Cloud Run.
The Cloud Run docs provide a snippet to create a create a connection but I'm not sure how to convert that connection into a valid Prisma connection too...
The Node.js snippet for Private IPs from the docs
const createTcpPool = async config => {
// Extract host and port from socket address
const dbSocketAddr = process.env.DB_HOST.split(':');
// Establish a connection to the database
return await mysql.createPool({
user: process.env.DB_USER, // e.g. 'my-db-user'
password: process.env.DB_PASS, // e.g. 'my-db-password'
database: process.env.DB_NAME, // e.g. 'my-database'
host: dbSocketAddr[0], // e.g. '127.0.0.1'
port: dbSocketAddr[1], // e.g. '3306'
// ... Specify additional properties here.
...config,
});
};
janpio
janpio
Sytten
06/23/2021, 3:57 PMSytten
06/23/2021, 3:58 PMSytten
06/23/2021, 3:58 PMSpencer Curry
06/23/2021, 3:59 PMSpencer Curry
06/23/2021, 3:59 PMSytten
06/23/2021, 3:59 PMSpencer Curry
06/23/2021, 3:59 PMjanpio