我有一个函数可以解密发送给它的加密变量。我只是复制并粘贴了代码中的代码,该代码位于aws lambda控制台中的encypt按钮旁边。经过一些修改后,这是我的代码:
var decryptEnvVariable = function (encryptedEnvVar) {
var promise = new Promise(function (resolve, reject) {
const kms = new AWS.KMS();
kms.decrypt({CiphertextBlob: new Buffer(encryptedEnvVar, 'base64')}, (err, data) = > {
if (err) {
console.log('Error in decryption of environment variable', err);
reject(err);
}
resolve(data.Plaintext.toString('ascii'));
});
});
return promise;
}
所以当我调用上面的内容时,我收到以下错误:
``START RequestId: eb7dd1ac-4549-11e7-b41b-071b15adaf2f Version: $LATEST
module initialization error: ReferenceError
kms.decrypt({CiphertextBlob: new Buffer(encryptedEnvVar, 'base64')}, (err,
data) = > {
^^^^^^^^^^^
ReferenceError: Invalid left-hand side in assignment
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
END RequestId: eb7dd1ac-4549-11e7-b41b-071b15adaf2f
REPORT RequestId: eb7dd1ac-4549-11e7-b41b-071b15adaf2f Duration: 56.15 ms
Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
有什么想法吗?
答案 0 :(得分:3)
您确定不仅仅是= >
到=>
(没有空格)吗?