Lan*_*ngo 5 javascript amazon-web-services aws-sdk
我的以下代码:
var AWS = require('./aws-sdk-2.2.10.js') // THIS LINE ERRORS
Run Code Online (Sandbox Code Playgroud)
产生以下错误:
Uncaught TypeError: Cannot read property 'crypto' of undefined
Run Code Online (Sandbox Code Playgroud)
这是抛出错误的aws-sdk-2.2.10.js的一部分
...
65: [function(require, module, exports) {
(function() {
var _global = this; // I think 'this' is undefined here
var mathRNG, whatwgRNG;
mathRNG = function(size) {
var bytes = new Array(size);
var r;
for (var i = 0, r; i < size; i++) {
if ((i & 0x03) == 0)
r = Math.random() * 0x100000000;
bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return bytes;
}
;
if (_global.crypto && crypto.getRandomValues) { // THIS LINE ERRORS
whatwgRNG = function(size) {
var bytes = new Uint8Array(size);
crypto.getRandomValues(bytes);
return bytes;
}
;
}
module.exports = whatwgRNG || mathRNG;
}
)();
}
...
Run Code Online (Sandbox Code Playgroud)
我的代码是通过webpack构建的,我的代码存放在条目文件app.js中.
我不确定为什么这不起作用?
编辑:如果重要,我的最终目标是使用Parse的CloudCode来放置和获取s3中的文件
| 归档时间: |
|
| 查看次数: |
991 次 |
| 最近记录: |