Fork me on GitHub
#aws
<
2023-12-25
>
Nimrod Sadeh03:12:13

I am getting the following error trying to run uberjar on a project containing the AWS cognitect library:

Execution error (AssertionError) at cognitect.aws.credentials/basic-credentials-provider (credentials.clj:346).
Assert failed: Missing
access-key-id
I am passing my access key ID via environment variable since I am using Digital Ocean, not AWS:
(def s3 (aws/client {:api :s3
                     :credentials-provider (credentials/basic-credentials-provider
                                            {:access-key-id (:access-key env/digital-ocean)
                                             :secret-access-key (:secret-key env/digital-ocean)})
                     :endpoint-override {:hostname (:hostname env/digital-ocean)
                                         :protocol :https}
                     :region "us-east-2"}))
Where env comes from environ. How can I bypass this?

Nimrod Sadeh03:12:39

This code works fine in REPL, btw

Nimrod Sadeh03:12:49

Confirmed by using or to pass an empty string to the constructor

scottbale14:12:13

If this works fine in the REPL, then I suspect some difference in the environment when uberjar is being run. If I were you, I'd add some debugging right before (def s3 ... to see what the env/digital-ocean map contains right before the exception occurs, whether or not it contains the expected environment variables.

Ben Sless14:12:12

Probably uberjar running with different environment than your repl You can check by printing (System/getEnv)

☝️ 2