-
Notifications
You must be signed in to change notification settings - Fork 83
Error: CognitoSyncManager is not a constructor #57
Comments
I have encountered the same problem. Also Angular 4 (4.4.4) and the following packages: The demo I started with (aws-cognito-apigw-angular) works fine, but I can't add sync to it. I think the issue is more that the entire "amazon-cognito-js" package cannot be found than a typings issue. I tried the above import as well as the "require" recommendations on a similar issue: I basically get an error in which AWS.CognitoSyncManager() is not returning a defined value: with the following code:
I have not found any combination of import/require that will return an actual value for AWS.CognitoSyncManager(). |
I have the same problem here. I'm initialising the CognitoSyncManager the following way:
and get the following error: If I run the build for a local web deployment with live reload, it interestingly works after a second compilation. So I only get this error at the first compilation attempt. But I'm not able to build it for android, as it directly fails. Could you make any progress on the issue? |
I notice you are both importing the SDK with all as AWS instead of getting the AWS export. It is working for me with these imports:
|
Thanks for the input, but sadly it doesn't change anything for me.
This way it can find the SyncManage during compilation (although it's empty) and during runtime it is working fine anyways. |
I see what you mean. Yes, the aws-cognito-js library is appending a class to the aws-sdk namespace at runtime, so would not be found during compilation. This can be seen in the source:
There are no exports in the CognitoSyncManager, and there are direct SDK property accessors. Frankly, this level of coupling between independent packages seems very strange to me. The aws-cognito-js package is designed as if it were part of the SDK file. |
I use this workaround:
|
I'm
working on an Ionic App with Angular 4 and TypeScript 2.3.4
Error:
ERROR TypeError: __WEBPACK_IMPORTED_MODULE_3_amazon_cognito_js__.CognitoSyncManager is not a constructor
.The text was updated successfully, but these errors were encountered: