You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function patchWithContext(fn, scopeName) {
scopeName = scopeName || 'loopback';
var ns = process && process.context && process.context[scopeName];
if (ns && ns.bind) {
fn = ns.bind(fn);
}
return fn;
}
....
MySQL.prototype.executeSQL = function(sql, params, options, callback) {
const self = this;
const client = this.client;
const debugEnabled = debug.enabled;
const db = this.settings.database;
if (typeof callback !== 'function') {
throw new Error(g.f('{{callback}} should be a function'));
}
if (debugEnabled) {
debug('SQL: %s, params: %j', sql, params);
}
const transaction = options.transaction;
callback = patchWithContext(callback);
....
and suddenly everything started working for us. Is it possible to implement this patch to loopback-connector-mysql?
Apologies if I'm missing something obvious - I am not a developer myself but a linux admin helping our devs move to nodejs 20/newer package versions.
The text was updated successfully, but these errors were encountered:
loopback: 3.28.0
loopback-context: 3.5.2
loopback-connector-mysql: 7.0.X
Hi,
When we tried switching to connector version 7.0.9 (mysql2) for our project, getContext() would get lost for no apparent reason. 6.2.0 (mysql) worked without issues, but even manually changing to const mysql = require('mysql2') in mysql.js with version 6.2.0 would start producing the same issue.
Googling led me to strongloop/loopback-context#21 (comment) and then to https://github.com/loopbackio/loopback-connector-mongodb/pull/275/commits
I've added
and suddenly everything started working for us. Is it possible to implement this patch to loopback-connector-mysql?
Apologies if I'm missing something obvious - I am not a developer myself but a linux admin helping our devs move to nodejs 20/newer package versions.
The text was updated successfully, but these errors were encountered: