[CLJS-2738] Can't use aws-amplify or aws-sdk with npm-deps Created: 15/Apr/18 Updated: 09/Aug/18
If I put aws-amplify in :npm-deps it seems to require aws-sdk, but when I put aws-sdk in there, it outputs this error:
|Comment by Jeffrey Stanton [ 26/Apr/18 2:51 PM ]|
I've also run into the same issue. Here's a simple repro:
|Comment by Mike Fikes [ 05/May/18 7:35 PM ]|
The big picture is not completely clear to me for this one, but it appears that the NPM version of the library is not intended to be used directly from the browser runtime, and instead you need to build it so that it is packaged for the browser.
The root problem is that the code is attempting to use Node's fs code, but from the browser.
You can see that the code can be compiled and executed if you target Node: If you modify Jeffrey's minimal repro to add
to the bottom of src/foo.cljs then things will compile and execute in Node:
If this can be confirmed, then this issue can be resolved as a non-issue, and it is just a matter of correct use of the library.
|Comment by David Whittington [ 05/May/18 8:23 PM ]|
I can confirm that it works in the browser with the AWS recommended browser build process. I was hoping it would also work as a node dep, but I think you're probably right that it's just not intended to be used that way.
|Comment by Christian Paul Dehli [ 09/Aug/18 9:55 PM ]|
Like Mike said, it looks to be coming from this line in the code: https://github.com/aws/aws-sdk-js/blob/ebe83921863f1eb020b6a07ef471f2017cd58550/lib/util.js#L39. process.browser is what's indicating to aws-sdk whether or not it's a browser environment.