1

It seems bizarre and unnatural that I should have to get 3 allied script files from 3 unrelated locations to do one simple thing. Is there a single source location for all the AWS SDK js scripts that I need to develop the client-side of a web-site? I only require the Cognito service.

I am following this tutorial here, to demonstrate how to register a new user to an Amazon Cognito User Pool via a browser.

The scripts linked in the head of the html file are something like ...

<script src="js/amazon-cognito-auth.min.js"></script> <script src="https://sdk.amazonaws.com/js/aws-sdk-2.668.0.min.js"></script> <script src="js/amazon-cognito-identity.min.js"></script> 

After these scripts are loaded, and the user requests registration, the following is a an over-simplified version of the javascript that gets executed, leveraging these 3 scripts:

poolData = {UserPoolId: <redacted>, ClientId: <redacted>}; var userPool = new AmazonCognitoIdentity.CognitoUserPool( poolData); userPool.signUp( username, password) 

Following the tutorial instructions, I source amazon-cognito-auth from:

I source amazon-cognito-identity by executing (windows):

  • npm install amazon-cognito-identity-js

And of course https://sdk.amazonaws.com/js/aws-sdk.js is a direct link.

Please advise how to get all 3 scripts from a single unified source.

As an ancillary question, does the AWS JS SDK support the require-js module loader?

1 Answer 1

1

Just checked the source of aws-sdk-js for browser:

https://raw.githubusercontent.com/aws/aws-sdk-js/master/dist/aws-sdk.js

From what I can see it does not support RequireJS out of the box. This bundle contains one dependency which support RequireJS, but everything else does not. So you will probably need shim configuration.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.