Closed Xuqing888 closed 1 year ago
Looks like if I use:
var greengrasscoreipc = require('aws-iot-device-sdk-v2/lib/greengrasscoreipc')
const ipcClient = greengrasscoreipc.createClient()
ipcClient.connect().then((r: any) => console.log(r));
then it works, but import {createClient} from 'aws-iot-device-sdk-v2/lib/greengrasscoreipc'
doesn't work.
While the chance that it is our problem is pretty high vs. it being typescript's, I'm looking at https://nodejs.org/api/buffer.html#static-method-bufferfromarraybuffer-byteoffset-length and see nothing that indicates our usage is incorrect. You should be able to work around the issue by changing your version of typescript at the very least.
Thanks, what typescript version do you suggest here?
The reason I am using 5.0.x typescript if to work around another
node_modules/aws-iot-device-sdk-v2/lib/eventstream_rpc.ts:803:5 - error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
803 constructor(private operationConfig: OperationConfig, private serviceModel: EventstreamRpcServiceModel) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
804 if (!serviceModel.operations.has(operationConfig.name)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
810 this.operation = new OperationBase(this.operationConfig);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
811 }
~~~~~
node_modules/aws-iot-device-sdk-v2/lib/eventstream_rpc.ts:888:5 - error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
888 constructor(private request: RequestType, private operationConfig: OperationConfig, private serviceModel: EventstreamRpcServiceModel) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
889 if (!serviceModel.operations.has(operationConfig.name)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
900 this.responseHandled = false;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
901 }
~~~~~
compilation error if I use ~4.x.x version. If I use 5.0.x version, this error is gone
I havent seen any issues with the version used by the gg_ipc sample.
I am able to build the gg_ipc sample with 5.0.4
Maybe you need to add @types/node to your project?
Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.
Describe the bug
Hey SDK team:
I hit the:
issue when I try to import anything from
aws-iot-device-sdk-v2/lib/greengrasscoreipc/client
likeimport * as greengrasscoreipc from 'aws-iot-device-sdk-v2/lib/greengrasscoreipc/client';
, while importingaws-iot-device-sdk-v2/lib/greengrasscoreipc/model
works fine.I am using Node 18 and "typescript": "^5.0.4", my package.json is as following:
Expected Behavior
Importing should work smoothly
Current Behavior
I can't import anything
Reproduction Steps
If you use Node18 and my package.json, you can probably hit this issue.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
"aws-iot-device-sdk-v2": "^1.12.1",
Environment details (OS name and version, etc.)
MACOS