我刚刚开始使用 Clojurescript。我编写了一些 clojurescript 代码来使用共享的 aws 凭证文件来初始化 S3 客户端和列出存储桶。但是我的代码不起作用。
(defn -main [arg1 arg2]
(println "hello")
(let[ creds (new AWS/SharedIniFileCredentials #js{:profile "superman"})
_ (AWS/config.update creds)
; dump out the accesskey to check if it has the correct profile
_ (AWS/config.getCredentials (fn [err] (if (nil? err) (do
(println "its good")
(println AWS/config.credentials.accessKeyId)))))
s3 (new (.-S3 AWS ))
] (.listBuckets s3 (fn[err buckets] (println "err: " err) (println buckets) )) ))
上面的 AWS/config.getCredentials 确实选择了正确的配置文件,如(println AWS/config.credentials.accessKeyId)
. listbuckets 代码引发以下错误:
#object[NodeError TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined]
我有 Google AWS SDK S3 clojuresript 并且是我找到的唯一链接。我用它来配置 S3 客户端,但这似乎不起作用
我将不胜感激任何帮助。