I’m using the mysql
Node module from within an Action that runs in the Post Login flow to insert a user into my own database if necessary. I’m only storing metadata such as name and email, rather than passwords, thus this flow rather than integrating my DB as a custom DB. I’ve gotten it to work, but I ran into some difficulty where log statements weren’t doing anything from within callbacks. For instance, this code:
console.log("Pinging DB");
db.ping(function (err) {
if (err) throw err;
console.log('Server responded to ping');
});
console.log("Next step...");
Would result in “Pinging DB” and “Next step…” getting logged to the test output, but “Server responded to ping” would never appear. Is there a workaround for this, or some other way I should be logging from within callbacks? Just to be clear – the MySQL calls are working, so I know the callback code is getting executed, it’s just the log statements that are ineffective.
Hi @iancroptix
At a guess, your db.ping statement is causing an error, which gets thrown.
Put a console.log right before the if, and see if something shows up
John
1 Like
No luck, unfortunately. Changed it to:
console.log("Pinging DB");
db.ping(function (err) {
if (err) {
console.log("Error pinging DB:", err);
throw err;
}
console.log("Server responded to ping");
});
…and still not seeing anything from the callback.
If an error is thrown, however, shouldn’t it show up in the “Errors” section after testing the Action?
Hi @iancroptix
You need a console log right before the “if”, like:
db.ping(function (err) {
console.log("Here with err: ", err);
if (err) {
…
John
1 Like
I’m not sure how that changes anything, since the console log happens before the throw, and another log happens if there’s no error. Regardless, I added in the log right before the “if” as you indicated, and I still see no output from that statement or any other inside a callback.
Hey team! 
Since this topic touches Auth0 Actions, quick heads-up that we’re hosting an Ask Me Anything dedicated to Actions with Gaston Danilo Asis Sanchez, Senior Technical Product Manager. We’ll cover practical usage, new capabilities like Transaction Metadata and Actions Types, plus a peek at what’s next. 
- Submit questions now through Aug 26

- Get detailed written answers live on Aug 27, 9–11 AM PT

Earn community points + a badge
. If you’re exploring how Actions can streamline your auth flows, this is a great time to get direct guidance from the team.
Join the AMA & drop your questions here: August 27 Auth0 Community Ask Me Anything: Actions
Dawid