Trouble using AWS Javascript SDK with QML (Undefined).
-
wrote on 3 May 2019, 13:45 last edited by
I'm attempting to utilize the AWS Javascript SDK in a Qt Quick project. Specifically the AWS Cognito User Pools.
I'm importing the SDK like this:
import "aws-sdk.js" as AWS ... //Later Calling like this var userPool = new AWS.AmazonCognitoIdentity.CognitoUserPool(poolData);
Receiving an error:TypeError: Cannot read property 'CognitoUserPool' of undefined
I added the aws-sdk.js by using add existing file from Qt Creator and selecting the file which is in the source directory. Is there something else I need to do to enable the use of the SDK?
-
wrote on 3 May 2019, 14:16 last edited by
Does that code assume it is running in a web browser? It may be expecting a DOM to be available as well as other common objects that browsers support. Are you sure that Qt JS is compatible? You may need to go through the AWS code and see if it relies on anything specific to browsers.
-
wrote on 3 May 2019, 14:27 last edited by James Hankins 5 Mar 2019, 14:28
It’s quite possible as AWS does have two versions of the JavaScript SDK. One for browsers and 1 for NodeJS. Thanks, I will dig into this.
1/3