Skip to content

GraalVM and Clojurescript compatibility #120

@jeroenvandijk

Description

@jeroenvandijk

Thank you for developing and sharing this library!

I would love to use (parts) of this library in other contexts than the normal JVM:

  • A native image with GraalVM
  • A NodeJS environment (via Clojurescript or Sci)

In these more exotic environments, it is not possible to use this library due to its dependencies on JVM specifics or incompatibilities with GraalVM. The consequence is that one cannot benefit from all the work that has gone into this library. In order to increase the reach of this library I would like to suggest to consider extracting parts of this library and make it CLJC compatible.

To give a specific example, I'm building a GraalVM command line tool that needs to call the AssumeRole API (and others). There is no JVM library that is compatible with GraalVM that allows me to do this. We have solved this by shell-ing out to the python AWS cli tool. Now we see this same issue in an AWS Lambda context. There are new constraints that require a new non-clj "solution".

If parts of this library were available to me in these environments, I wouldn't have to shell out or find some other workaround. With minimal code, I would be able to do the API call myself.

I think the most important parts of this library are ready to go as is. The part that I need most is

  • [cognitect.aws.signers]
    The url-encoding needs a platform specific implementation (e.g. js/encodeURIComponent(s))

Ideally, there would be a function that would "export" the request that will be done. E.g. (aws/invoke sts {:op :AssumeRole :request { :RoleArn "role-arn-here", :RoleSessionName "session-name-here"}}) would give me something like*:

{:remote-addr 127.0.0.1, :headers {accept-encoding gzip, authorization AWS4-HMAC-SHA256 Credential=ABC/20200130/us-east-1/sts/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=698cb22807c63f8417d99ebaa234eb7173b000a2256a7e01ee00171e3b974963, content-length 92, content-type application/x-www-form-urlencoded; charset=utf-8, host localhost, user-agent Jetty/9.4.15.v20190215, x-amz-date 20200130T124646Z}, :async-channel #object[org.httpkit.server.AsyncChannel 0x4232f55e /127.0.0.1:8080<->/127.0.0.1:56095], :server-port 80, :content-length 92, :websocket? false, :content-type application/x-www-form-urlencoded, :character-encoding utf-8, :uri /, :server-name localhost, :query-string nil, :body #object[org.httpkit.BytesInputStream 0x730737c BytesInputStream[len=92]], :scheme :http, :request-method :post}
BODY: Action=AssumeRole&Version=2011-06-15&RoleSessionName=session-name-here&RoleArn=role-arn-here

Thank you for your attention! Feel free to ask me for more clarification on this subject.

(*) I intercepted this request by overriding the endpoint and running a local server:

(def sts (aws/client {:api :sts 
                      :credentials-provider (credentials/basic-credentials-provider
                        
                                             {:access-key-id     "ABC"
                                             :secret-access-key "XYZ"})     
                      :endpoint-override {:protocol :http
                                          :hostname "localhost"
                                          :port     8080}}))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions