nativescript-nodeify icon indicating copy to clipboard operation
nativescript-nodeify copied to clipboard

AWS Amplify Support

Open collindutter opened this issue 6 years ago • 19 comments

Has anyone successfully gotten nodeify working with AWS Amplify? I'm attempting to use the library but am getting JS ERROR ReferenceError: Can't find variable: Buffer

Any help would be great!

collindutter avatar Apr 04 '18 01:04 collindutter

Does this comment help?

EddyVerbruggen avatar Apr 04 '18 09:04 EddyVerbruggen

@EddyVerbruggen thank you for the quick response!

Unfortunately, I don't think that comment helps. I'm already importing the plugin before use of Amplify.

screen shot 2018-04-04 at 12 53 23 pm

Are there any additional steps I should be taking?

collindutter avatar Apr 04 '18 19:04 collindutter

@collindutter Have you tried actually require-ing? require("nativescript-nodeify"); -- I mean, depending on your buildsystem and whether or not you're using the imported Nodeify var the require may not even end up in the generated .js file.

EddyVerbruggen avatar Apr 04 '18 20:04 EddyVerbruggen

Getting the same issue with

screen shot 2018-04-04 at 1 31 35 pm

collindutter avatar Apr 04 '18 20:04 collindutter

Can you share a repro so I can take a look?

EddyVerbruggen avatar Apr 04 '18 20:04 EddyVerbruggen

When configured on a fresh project, I get Can't find variable: window. Here is the project: https://github.com/collindutter/NodeifyAmplify

Thanks for the help!

EDIT: Just to clarify, I'm including the library in auth.service.ts. When I include nodeify with import * as Nodeify from 'nativescript-nodeify; I get Can't find variable: Buffer. But when I include nodeify with require('nativescript-nodeify'); I get Can't find variable: window.

collindutter avatar Apr 04 '18 21:04 collindutter

Not sure how much this helps, but it looks like people using react and rn-nodeify were able to get it working https://github.com/aws/aws-amplify/issues/140

collindutter avatar Apr 05 '18 18:04 collindutter

@EddyVerbruggen were you able to find anything in the repo I linked?

collindutter avatar Apr 14 '18 00:04 collindutter

anyone found the working solution for aws-amplify

praveshkhatana avatar Apr 28 '18 21:04 praveshkhatana

I am not getting same error message but the different one

navigator is not defined

Getting this message when trying to call "

Amplify.configure()

"

ERROR Error: Uncaught (in promise): ReferenceError: navigator is not defined
JS: ReferenceError: navigator is not defined
JS:     at standardBrowserEnv (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/helpers/isURLSameOrigin.js:11:39)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/helpers/isURLSameOrigin.js:60:5)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/adapters/xhr.js:7:23)
JS:     at require (<anonymous>:1:266)
JS:     at getDefaultAdapter (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/defaults.js:20:15)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/defaults.js:29:12)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/core/Axios.js:3:16)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/axios.js:5:13)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/index.js:1:78)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/aws-amplify/lib/API/RestClient.js:70:15)
Successfully synced application org.nativescript.awsamplify on device 3421353f0604.
ActivityManager: Start proc 17292:org.nativescript.awsamplify/u0a341 for activity org.nativescript.awsamplify/com.tns.NativeScriptActivity
JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
JS: ERROR Error: Uncaught (in promise): ReferenceError: navigator is not defined
JS: ReferenceError: navigator is not defined
JS:     at standardBrowserEnv (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/helpers/isURLSameOrigin.js:11:39)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/helpers/isURLSameOrigin.js:60:5)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/adapters/xhr.js:7:23)
JS:     at require (<anonymous>:1:266)
JS:     at getDefaultAdapter (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/defaults.js:20:15)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/defaults.js:29:12)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/core/Axios.js:3:16)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/lib/axios.js:5:13)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/axios/index.js:1:78)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/org.nativescript.awsamplify/files/app/tns_modules/aws-amplify/lib/API/RestClient.js:70:15)

praveshkhatana avatar Apr 28 '18 22:04 praveshkhatana

Changed it to "aws-amplify": "^0.2.9" version and everything working fine now :)

just getting few warning messages only

praveshkhatana avatar Apr 29 '18 21:04 praveshkhatana

Changed it to "aws-amplify": "^0.2.9" version and everything working fine now :)

just getting few warning messages only

Are you still using aws-amplify along with nativescript-nodeify? And if yes, have you been able to get it to work with a newer version of aws-amplify as we're now on 1.+?

envisean avatar Mar 16 '19 02:03 envisean

@envisean yes it’s working fine with latest amplify version.

praveshkhatana avatar Mar 16 '19 05:03 praveshkhatana

Hello guys, can any of you explain to me how did you get it to work with Amplify v3?

I am having the window is not defined error for ages now, and I cannot find how to define it. Should I create a shim or how?

asciidiego avatar Jun 07 '20 16:06 asciidiego

@collindutter Did you arrive to a solution?

asciidiego avatar Jun 12 '20 19:06 asciidiego

@diegovincent sorry I dropped this a couple years ago. I don't think I ever reached a solution myself.

collindutter avatar Jun 12 '20 20:06 collindutter

@collindutter

Oh no! I hope it turned out ok!

Well, thanks for posting it anyways, if by any chance you are interested, leave a like at my message here so maybe we can attract developers of the community to solve this important issue (I think "officially" supporting AWS is a pressing matter if we want people to adopt and improve the NativeScript community and technology).

Thanks for your fast reply! And good luck with your projects.

D.

asciidiego avatar Jun 12 '20 20:06 asciidiego

@diegovincent Just dropped a like, best of luck!

collindutter avatar Jun 12 '20 20:06 collindutter

@collindutter could you re-open it?

asciidiego avatar Jun 26 '20 08:06 asciidiego