-
Notifications
You must be signed in to change notification settings - Fork 6
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
Problems in node 9 and crypto #9
Comments
This is due a breaking change (for undocumented behavior) in NodeJS v9. See here for more details on the cause: nodejs/node#16778 This is fixed in newer version of rand-token by commit 763df11. Upgrade to the latest version (v0.4.0 as of writing this) of rand-token and it'll be resolved. |
I have updated to v0.4.0 and the same issue still there. I'm on ubuntu 17 node 9.3 |
@martinbedouret Clear your dependencies (via
|
The app is crashing when calling the `login` action on `UsersAuthController`, due to an undocumented change in Node.js v9 that breaks `rand-token`, but it was fixed on version `0.4.0`. I am using Node.js `9.5.0` and I can confirm crash is now gone after this update. Error output was: ``` internal/crypto/random.js:44 throw new errors.TypeError('ERR_INVALID_CALLBACK'); ^ TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at Object.randomBytes (internal/crypto/random.js:44:11) at Object.options.source (/Users/jp/spare/react-native-authentication/server/node_modules/rand-token/index.js:60:25) at Object.generate (/Users/jp/spare/react-native-authentication/server/node_modules/rand-token/index.js:95:29) at child.findOrAdd (/Users/jp/spare/react-native-authentication/server/api/models/Tokens.js:31:21) at child.wrapper [as findOrAdd] (/Users/jp/spare/react-native-authentication/server/node_modules/lodash/index.js:3095:19) at passport.authenticate (/Users/jp/spare/react-native-authentication/server/api/controllers/UsersAuthController.js:36:18) at BasicStrategy.strategy.success (/Users/jp/spare/react-native-authentication/server/node_modules/passport/lib/middleware/authenticate.js:201:18) at verified (/Users/jp/spare/react-native-authentication/server/node_modules/passport-http/lib/passport-http/strategies/basic.js:91:10) at bcrypt.compare (/Users/jp/spare/react-native-authentication/server/config/passport.js:48:13) ``` More info: sehrope/node-rand-token#9 Cheers and thank you for your post! https://medium.com/@alexmngn/the-essential-boilerplate-to-authenticate-users-on-your-react-native-app-f7a8e0e04a42 👍🏻 🍻
See for instance: - whitef0x0/node-email-verification#78 - sehrope/node-rand-token#9 Ideally we'd bump up the dependency on rand-token to 0.4.0, and release a new consultation-verification package. However, we can't publish consultation-verification to npmjs.com, because we do not have the required credentials. Until consultation-gouv/npm.verif.consultation#3 is fixed, this nasty manual fix will have to do.
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at randomBytes (internal/crypto/random.js:44:11)
It is explained here
https://github.com/diegohaz/rest/issues/133
The text was updated successfully, but these errors were encountered: