Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First stab at CLJS support #121

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jeroenvandijk
Copy link

I know you don't accept pull requests, please consider this as a FYI of the (minimal) number of changes when porting this library to CLJS (#11 and #120)

I've copied a compile script (script/compile-js). This script generates a minified js script of this project. "It compiles", the result still needs to be tested.

Hope this helps, feel free to ignore otherwise. Also, anything here is available for usage how you desire.

@jeroenvandijk
Copy link
Author

I've published a minimal fork of this repo here https://github.com/AdGoji/aws-api

It only does the signing at the moment. All the shaping of requests and handling of responses needs to be done manually (see this STS example)

The http client needs to be chosen by the user of the library. For Graalvm I have used a wrapper around curl. For nodejs I used the 'request' library.

With all that said it does work in Graalvm and Clojurescript.

@kivilahtio
Copy link

Thanks to you, I think I'll pick this library over
aws-clj-sdk and amazonica

@loganpowell
Copy link

+1 'ing this (due to the faster cold start times for clojurescript in lambda)

@include
Copy link

include commented Jul 29, 2020

Is there any "official" message about this "very desired" support? :)

@dchelimsky
Copy link
Contributor

Is there any "official" message about this "very desired" support? :)

No

@dchelimsky
Copy link
Contributor

Is there any "official" message about this "very desired" support? :)

No

That was short and unhelpful of me. Apologies.

This is not a priority for us, and is not on any near or mid-term road map. We're not closed to the idea, but it would increase the maintenance burden, so we wouldn't pursue it without a very strong rationale.

To that end, what are the problems that you think this would solve?

@jeroenvandijk
Copy link
Author

To that end, what are the problems that you think this would solve?

For me, cljs specifically would help in writing AWS Lambda functions from Cloudformation. AWS only allows python and node.js functions to be defined inline. By creating an AWS Lambda layer with Sci and this library, one could write all the AWS glue code in clojure from a Cloudformation template. (I can confirm this works, I've tested it with my fork)

Another reason I'm interested in the cljs direction is that platform specific code will have to be identified which will likely help in using this library in cli projects with Graalvm or Babashka.

@lvh
Copy link

lvh commented Aug 6, 2020

I can mostly just echo everything @jeroenvandijk said. Without being able to run against Graal or JS, you can't use this for Lambdas that take webhooks (which generally have response requirements faster than JVM spin-up time), or synchronous lambdas e.g. in CloudFront.

An approach I'm likely to try and take is simply fake out enough of the jetty client, but this has done most of that work.

@include
Copy link

include commented Aug 19, 2020

Thank you @dchelimsky for your reply. I am new to clj and cljs, so I don't know how difficult would be to do this. I just know some libs out there are able to support both. My use case is very simple. AWS Lambdas. I just can't start a discussion with clients about lambdas running java code :/ and of course all "lisp" discussion around this particular case :). With cljs at least I would spare the jvm excuse. Anyways I totally understand your point/strategy.

@digash
Copy link

digash commented Sep 17, 2020

@dchelimsky Just found this whole thread, I guess I'll add my no go with AWS Batch and Lambdas. Building prototype to evangelize Clojure in my company. I will continue doing some orchestration from Linux hosts using aws-api, but this was a particular pain point that would of convinced quite a few people to look into Clojure. I have to go back to pyhon or maybe try golang. Thank you for making this library.

@djjolicoeur
Copy link

@dchelimsky just wanted to add another voice here in favor of making this available from CLJS, although it does seem this is a bit dated now. I've used this library with the JVM in AWS lambdas and it worked fantastic. Far superior to the other options, and with a smaller foot print the in the final JAR file. I have a team that really wants to use Clojure, but we're beginning to work on things where cold start matters much like the scenarios @lvh mentioned. CLJS seems like it would be a good option, given a good interface like this to the AWS apis.

All of that said, I understand this may not be a priority for you all @ cognitect and I respect that. @lvh @jeroenvandijk did you all find another solution other than this library that worked for you? I'm curious what folks are doing with AWS lambdas that require fast cold start.

@iku000888
Copy link

FWIW, https://github.com/babashka/pod-babashka-aws has been available for some time and has good parity to the extent I checked.

@djjolicoeur
Copy link

thanks @iku000888 I was looking into that as well, I just need to get up to speed on babashka. I worry about not having either the JS or java ecosystem to call on when we need to.

@iku000888
Copy link

@djjolicoeur I hear you. My 2 cents is babashka has pretty good coverage for what is available in java, author is open to adding library as a built-in, and pods are a good facility for adding support for libs (apparently can run non java stuff).

@grzm
Copy link

grzm commented Oct 11, 2022

In the babashka world, I'd encourage you to take a look at https://github.com/grzm/awyeah-api. Doesn't satisfy the cljs desire, but works well for scripting needs (though I'm likely biased). While not aws-api exactly, I've heard people having good experiences with nbb + aws-sdk-js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants