EddyVerbruggen / nativescript-nodeify

Makes most npm packages compatible with NativeScript
MIT License
93 stars 27 forks source link

AWS Amplify Support #39

Open collindutter opened 6 years ago

collindutter commented 6 years ago

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!

EddyVerbruggen commented 6 years ago

Does this comment help?

collindutter commented 6 years ago

@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?

EddyVerbruggen commented 6 years ago

@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.

collindutter commented 6 years ago

Getting the same issue with

screen shot 2018-04-04 at 1 31 35 pm
EddyVerbruggen commented 6 years ago

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

collindutter commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

praveshkhatana commented 6 years ago

anyone found the working solution for aws-amplify

praveshkhatana commented 6 years ago

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 commented 6 years ago

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

just getting few warning messages only

envisean commented 5 years ago

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.+?

praveshkhatana commented 5 years ago

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

asciidiego commented 4 years ago

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 commented 4 years ago

@collindutter Did you arrive to a solution?

collindutter commented 4 years ago

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

asciidiego commented 4 years ago

@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.

collindutter commented 4 years ago

@diegovincent Just dropped a like, best of luck!

asciidiego commented 4 years ago

@collindutter could you re-open it?