How do I use external JS code, like e.g. AWS-SDK

Hi, sorry for the basic question, sure it’s trivial :confused:

In <Panel> I do

        <JavaScript File="aws-sdk-2.1.29.min.js" ux:Global="aws" /> 
        <JavaScript>
            ...
            var AWS = require('aws');
            ...
        </JavaScript>

But then how do I call AWS methods?

Just replicating the JS code I got working on an HTML5 webpage does not work, e.g.:

        AWS.config.update({accessKeyId: AKID, secretAccessKey: SAK});

I get

Output: Name: TypeError

ErrorMessage: undefined cannot be converted to an object

FileName: (no filename)

LineNumber: 14

StackTrace: TypeError: undefined cannot be converted to an object at anonymous ((no filename):14)

It’s obviously something fundamental I’m missing… Sorry to be such a drag!

Thanks! Leonardo

AWS probably depends on some browser features that fuse don’t support. I will take a look later and see if I can figure out what that is.

Hey Anders, thanks for that.

I look forward to what you can find out. I’m interested in ANY way to interact with AWS, even if more complex (UNO maybe?)

I assume that your answer also implies that my code is technically correct?

Thanks! Leonardo

Your approach is correct - but the FuseJS standard libraries may be missing browser APIs that the AWS lib depends on. We are currently researching that.

Also, how do I include a .js file from the web? In the case above, something like:

<JavaScript File="https://sdk.amazonaws.com/js/aws-sdk-2.1.49.min.js" ux:Global="aws" />

This feature is planned, but for now you have to manually download the file and keep a local copy.

Thanks! I look forward to hear about AWS and how to make it work.

Hi Anders,

any news re. the FuseJS standard libraries may be missing browser APIs that the AWS lib depends on. We are currently researching that.?

Looking forward to it!!

Thanks

Hi all,

Any news about Leonardo questions? may I use AWS Javascript SDK in FUSE?

Thank you,
Fernando

Our attempts 11 months ago failed and at least I have not looked that much into it since. Which one of the AWS services do you need most?

Hi Anders,

We are trying to work with AWS Cognito and AWS S3. I did a PoC with the latest version for AWS Javascript SDK and I am getting a “System.Exception” in FUSE. We can do it using Foreign code but we have more experience with Javascript and if AWS Javascript SDK works in FUSE, we don’t need to write twice the same code to support iOS & Android.

Do you have any plan to support the AWS Javascript SDK?

thank you,
Fernando

I can’t promise that we are going to support it, because it is a huge library not written for our platform. And we are not able to replicate all the browser functionality, but I will take a look to see how far I can get.

Hi Anders,

Just a suggestion, but it would be amazing if at least you could get the combination of API Gateway, AWS Lambda, and Dynamo DB to work. That way you could construct an alternative serverless infrastructure for FUSE apps using AWS via the SDK.

Thanks!

I have made progress on this (some fixes in the libs need to roll out first). I don’t know what parts of the SDK will work yet, but S3 storage seems to work successfully.

Is there any progress on AWS Cognito SDK?

I’m interested in this work too!