Property 'newStatic' does not exist on type 'typeof AwsCredentialsProvider'.
karllundgren opened this issue · 3 comments
I am using aws-iot-device-sdk-js-v2, following the example:
https://github.com/coderbyheart/aws-iot-device-sdk-js-browser-esm/blob/cdefd5912f5e3c78fd0fe99cec7b512a4215b287/index.js
to create an MQTT client that connects to AWS IoT Hub.
Per the documentation I've found:
https://aws.github.io/aws-iot-device-sdk-js-v2/node/classes/http.AwsCredentialsProvider.html
AwsCredentialsProvider has 2 methods, newDefault(), and newStatic(). However, only newDefault() is defined, newStatic() doesn't exist.
I have aws-crt installed at version 1.14.1, and my code is using the implementation of AwsCredentialsProvider as defined at node_modules\aws-crt\dist\native\auth.d.ts
Node and browser have close but not quite identical capabilities, leading to slight differences in API contract, based on what we can get out of the browser-only dependencies. You've linked a browser sample but the node API docs. Try working from https://aws.github.io/aws-iot-device-sdk-js-v2/browser/modules/auth.html for relevant browser docs, or don't use a browser-based sample as your basis.
Revisiting this for unrelated reasons, it looks like we don't export newStatic from its internal native implementation. It should be fixed as part of other work shortly.
Assuming a node environment, I believe this was addressed by #356