Giovanni Minchio
unread,May 9, 2022, 4:56:28 PM5/9/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Cloud SQL discuss
Hi
Im having trouble connecting via service (which is running in cloud run) to my db instance (mysql). I search almost everywhere online but none of the provided solutions worked for me.
The error happend when i try to query the db , here a code snippet:
ABOUT THE POOL INSTANCE
const pool = mysql.createPool({
user:'username',
password:'password',
database:'dbname',
socketpath:'the instance name given by the instance info page',
});
HOW IM TRYING TO QUERY IT
app.get("/:ATT", async (req, res)=>{
const query = "SELECT * FROM tabelnameWHERE attribute=?";
pool.query(query, [req.params.ATT], (error, results)=>{
if(error){
res.json(ERROR);
}
else{
res.json({status:"done !"});
});
});
the ERROR returned me the following:
{"errno":-2,"code":"ENOENT","syscall":"connect","address":"/cloudsql/
the instance name given by the instance info page ","fatal":true}
the instance name im using im sure 100% is the right one
Anyone can help?
I can't get out of it
Thanks in advance.
PS: i already tried to use the same region for all the projects part but nothing has changed
i tried also to add at the end of the instance name "s.PGSQL.5432", which shuold be completly useless, since is for postresql i assume (but i was completly lost so i gave it a try anyway)