Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError AWS.KinesisVideo is not a constructor

I installed aws-sdk using the below command

npm install --save aws-sdk

and i get an error

TypeError AWS.KinesisVideo is not a constructor

for the below code

var kinesisvideo = new AWS.KinesisVideo();

AWS.IAM is not a constructor JavaScript SDK post mentioned the error could be because the KinesisVideo module isn't present.

My question is how do i install all modules of aws-sdk via npm.

Thanks

like image 382
J28 Avatar asked Jun 21 '18 10:06

J28


2 Answers

There are 2 main methods of downloading the full AWS SDK for browsers (load it in using a <script> tag) and Node.js backends.

  1. Download a custom SDK from the AWS website

    You can choose which modules and services to download in the online SDK builder at https://sdk.amazonaws.com/builder/js/

    Click Select All Services and click Build to download everything.

  2. Use the CLI to build the SDK

    Clone the official AWS SDK GitHub repository.

    <!-- language: lang-none -->
    
    git clone git://github.com/aws/aws-sdk-js
    cd aws-sdk-js
    

    After you clone the repository, download the dependency modules for both the SDK and build tool via the following command:

    npm install
    

    You can now build a packaged version of the SDK from the command line interface.

    Execute the following command to build the SDK with all services and API versions included:

    node dist-tools/browser-builder.js all > aws-sdk-full.js
    

    If you want a minified bundle, set the MINIFY environment variable.

    MINIFY=1 node dist-tools/browser-builder.js > aws-sdk-full.js
    

    *You must have Git and npm installed for this to work.

Extra resources:

  • https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/building-sdk-for-browsers.html

  • https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/installing-jssdk.html

  • https://github.com/aws/aws-sdk-js

  • https://www.npmjs.com/package/aws-sdk

like image 115
clickbait Avatar answered Oct 29 '22 20:10

clickbait


No. There is no way to install all modules together using npm.

But, You can use the SDK-builder tool from aws-sdk-js repo to create a minified bundle of ALL the AWS Services and include that bundle using <script> tag.

The command to generate a bundle of ALL the services:

node dist-tools/browser-builder.js all > aws-sdk-full.js

Check out this link for full-steps.

Hope this helps.

like image 2
yeshashah Avatar answered Oct 29 '22 20:10

yeshashah