Red Hat Bugzilla – Bug 1253927
Node default module crypto doesn't work properly
Last modified: 2017-05-31 14:22:11 EDT
Created attachment 1063300 [details]
Since the last maintenance on nodejs my app doesn't work properly. it gives me this error:
var cryptedSessionKey = crypto.publicEncrypt(publicKey, sessionKey);
TypeError: Object #<Object> has no method 'publicEncrypt'
crypto is initialized in this way: var crypto = require('crypto'); and crypto is a default module that doesn't require npm installation (but i've also tried this) indeed the app still works in local on my pc and worked on openshift until yesterday.
The publicEncrypt method was added to Node.js's crypto core module in the v0.11.14 release (per `git tag --contains=42bda05af8d628db90f3ee64fa2dd89973cb1e03`). The crypto core module was introduced in Node.js in the v0.1.92 release (per `git tag --contains=80174392bbcec0cec1c79628fb09af351a6488aa`). According to the Node.js documentation,
"Core modules are always preferentially loaded if their identifier is passed to require(). For instance, require('http') will always return the built in HTTP module, even if there is a file by that name."
The version of Node.js we provide in OpenShift has thus far always been strictly between v0.1.92 and v0.11.14. Therefore crypto.publicEncrypt() should never have worked in OpenShift when using the core library with var crypto = require('crypto');.
Is it possible you were using a custom cartridge with a newer version of Node.js (and thus a newer version of the crypto core module) when the application worked on OpenShift earlier, or that you were initialising (or re-initialising) crypto using a different library?
Hi, have you been able to look into this issue yet to answer the question in comment 1?
We apologize, however, we do not plan to address this report at this time. The majority of our active development is for the v3 version of OpenShift. If you would like for Red Hat to reconsider this decision, please reach out to your support representative. We are very sorry for any inconvenience this may cause.