-
-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoolCluster : TypeError: cb is not a function #3091
Labels
Comments
Probably related: |
Adding some info: I think that bug resides in PromisePoolCluster.of (promise.js). Instead of return a "PromisePoolNamespace" it returns another PromisePoolCluster: of(pattern, selector) {
return new PromisePoolCluster(
this.poolCluster.of(pattern, selector),
this.Promise,
);
} Maybe, creating a PromisePoolNamespace class like this, and returning an instance of this class by PromisePoolCluster.of, it will be fixed: class PromisePoolNamespace {
constructor(poolNamespace, thePromise) {
this.poolNamespace = poolNamespace;
this.Promise = thePromise || Promise;
}
getConnection() {
const corePoolNamespace = this.poolNamespace;
return new this.Promise((resolve, reject) => {
corePoolNamespace.getConnection((err, coreConnection) => {
if (err) {
reject(err);
} else {
resolve(new PromisePoolConnection(coreConnection, this.Promise));
}
});
});
}
} of(pattern, selector) {
return new PromisePoolNamespace(
this.poolCluster.of(pattern, selector),
this.Promise,
);
} |
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 4, 2024
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 4, 2024
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 5, 2024
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 6, 2024
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 10, 2024
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 10, 2024
jcmartineztiempo
added a commit
to jcmartineztiempo/node-mysql2
that referenced
this issue
Dec 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This error occurs when you call getConnection method on PoolNamespace instance.
The lib/pool_cluster.js file requires a cb parameter (1 argument) but it's undefined because PromisePoolCluster.getConnection in promise.js sends three (3) arguments: pattern, selector and a callback function, so wether calls getConnection without any argument, the cb argument is always undefined.
MyClass.ts
promise.js
pool_cluster.js
Environment
The text was updated successfully, but these errors were encountered: