AWS IoT Javascript SDK 无法创建客户端
AWS IoT Javascript SDK can not create client
我正在使用 Vue.js、TypeScript 和 aws-iot-device-sdk
包,并且喜欢订阅 IoT 主题。这就是我创建新客户端的方式:
import AwsIot from 'aws-iot-device-sdk';
import { config } from 'aws-sdk';
client = new AwsIot.device({
region: 'foo',
host: 'foo',
clientId: 'foo',
protocol: 'wss',
accessKeyId: config.credentials.accessKeyId,
secretKey: config.credentials.secretAccessKey,
sessionToken: config.credentials.sessionToken
});
一秒钟后,我收到此控制台错误:
Uncaught TypeError: Cannot read property 'read' of undefined
at nReadingNextTick (_stream_readable.js)
Uncaught TypeError: Cannot read property 'length' of undefined
at onwriteDrain (_stream_writable.js)
at afterWrite (_stream_writable.js)
Uncaught TypeError: Cannot read property 'length' of undefined
at onwriteDrain (_stream_writable.js)
at afterWrite (_stream_writable.js)
Uncaught TypeError: Cannot read property '_readableState' of undefined
at emitReadable_ (_stream_readable.js)
Uncaught TypeError: Cannot read property 'reading' of undefined
at maybeReadMore_ (_stream_readable.js)
node-libs-browser 对 process.nextTick
的实现不接受回调参数。只需在 main.ts
!
中覆盖它
process.nextTick = function(callback) {
const args = [...arguments];
args.shift();
setTimeout(() => callback.apply(null, args));
}
更新:
已在 v2.2.1 中修复:Commit
我正在使用 Vue.js、TypeScript 和 aws-iot-device-sdk
包,并且喜欢订阅 IoT 主题。这就是我创建新客户端的方式:
import AwsIot from 'aws-iot-device-sdk';
import { config } from 'aws-sdk';
client = new AwsIot.device({
region: 'foo',
host: 'foo',
clientId: 'foo',
protocol: 'wss',
accessKeyId: config.credentials.accessKeyId,
secretKey: config.credentials.secretAccessKey,
sessionToken: config.credentials.sessionToken
});
一秒钟后,我收到此控制台错误:
Uncaught TypeError: Cannot read property 'read' of undefined
at nReadingNextTick (_stream_readable.js)
Uncaught TypeError: Cannot read property 'length' of undefined
at onwriteDrain (_stream_writable.js)
at afterWrite (_stream_writable.js)
Uncaught TypeError: Cannot read property 'length' of undefined
at onwriteDrain (_stream_writable.js)
at afterWrite (_stream_writable.js)
Uncaught TypeError: Cannot read property '_readableState' of undefined
at emitReadable_ (_stream_readable.js)
Uncaught TypeError: Cannot read property 'reading' of undefined
at maybeReadMore_ (_stream_readable.js)
node-libs-browser 对 process.nextTick
的实现不接受回调参数。只需在 main.ts
!
process.nextTick = function(callback) {
const args = [...arguments];
args.shift();
setTimeout(() => callback.apply(null, args));
}
更新:
已在 v2.2.1 中修复:Commit