Skip to content
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

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function #6

Closed
svbatalov opened this issue Nov 8, 2018 · 2 comments
Closed

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function #6

svbatalov opened this issue Nov 8, 2018 · 2 comments

Comments

@svbatalov
Copy link

On Node.js v9+ pg-db throws this error:

$ node
> db = require('pg-db')();
...
> db.query('SELECT NOW(), (err, rows) => console.log(err, rows) );
undefined
> TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at Object.randomBytes (internal/crypto/random.js:48:11)
    at Object.options.source (.../node_modules/rand-token/index.js:60:25)
    at generate (.../node_modules/rand-token/index.js:95:29)
    at .../node_modules/pg-db/lib/index.js:385:21
    at .../node_modules/pg-db/lib/index.js:428:18
    at bound (domain.js:396:14)
    at runBound (domain.js:409:12)
    at .../node_modules/pg/lib/pool.js:84:11
    at .../node_modules/generic-pool/lib/generic-pool.js:347:9

Looks like this is the bug in node-rand-token which was fixed in recent versions. Can you update the version of node-rand-token in package.json?

Related issues:

Thanks.

@sehrope
Copy link
Owner

sehrope commented Nov 8, 2018

Are you on the latest version of this module?

The rand-token dependency was updated a few months ago (48f2401) and published to NPM as pg-db v2.0.0.

@svbatalov
Copy link
Author

You're right, version 2.0.0 works fine. Sorry for the noise! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants