NodeJS can’t await MySQL database promise, but awaits other promises

let static_times_generate = async (static_file_path) => { //Import MySQL database pool connection: const db = require('../database_pool.js'); const Promise_pool = db.promise(); //Import Static Text file dependencies: const { readFile } = require('fs/promises') , stop_times = static_file_path+'/stop_times.txt', trips = static_file_path+'/trips.txt'; let trip_data = (await readFile(trips,'utf8')).split('n').slice(1,2); let stop_times_data = (await readFile(stop_times,'utf8')).split('n').slice(1,-1); trip_data.forEach(trip_line => { const t_array = trip_line.split(','); … Read more

Await/Async nodejs with mysql db won’t giving result what is expected

const con = mysql.createConnection({ host: "localhost", user: "root", password: "anujsingh", database: "test", }); con.connect(function (err) { if (err) throw err; console.log("Connected!"); }); const selectCountries = async () => { let sql = "SELECT countries.* FROM countries"; try { let result = await con.query(sql); console.log(result); } catch (err) { console.log(err); } }; selectCountries(); Attached screenshot of … Read more

Upload in Firebase Storage and fetch link to add it in Realtime Database

I’m using Firebase Realtime Database and Firebase Storage in this application, the goal is to upload in Firebase Storage the images in the pictures array, and then get the link of the Firebase Storage to that image and add it in the object which will be pushed in imagesUriArray and added to Realtime Database. The problem is that when I press addItem it successfully update the id, but the images parameter remains empty. And in fact, imagesUriArray remains empty unless I refresh the screen.