This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aws (1)
- # aws-lambda (16)
- # beginners (8)
- # boot (2)
- # cider (4)
- # cljsrn (9)
- # clojure (137)
- # clojure-italy (3)
- # clojure-russia (39)
- # clojure-spec (34)
- # clojure-uk (33)
- # clojurescript (44)
- # core-logic (11)
- # cursive (27)
- # data-science (16)
- # datomic (52)
- # duct (1)
- # emacs (1)
- # figwheel (2)
- # fulcro (90)
- # graphql (3)
- # hoplon (7)
- # lambdaisland (2)
- # leiningen (23)
- # lumo (1)
- # off-topic (1)
- # om (40)
- # onyx (44)
- # re-frame (116)
- # reagent (3)
- # shadow-cljs (87)
Having problems with
lein-clj-lambda. I have a brand new AWS free tier account, and I just created a new IAM user. I installed the aws cli, and ran
aws configure --profile adminuser, and for instance I can successfully run
aws lambda list-functions --profile adminuser.
But if I try running
lein lambda -h from my clojure project I get a warning like this:
Oct 25, 2017 4:09:50 PM com.amazonaws.auth.profile.internal.BasicProfileConfigLoader loadProfiles WARNING: The legacy profile format requires the 'profile ' prefix before the profile name. The latest code does not require such prefix, and will consider it as part of the profile name. Please remove the prefix if you are seeing this warning.
So taking that warning at face value, I edited
~/.aws/config accordingly and discovered the lein plugin works but the AWS CLI no longer works. Making a mental note but moving on…
lein lambda install test fails. What it does do is build the uberjar, creates an IAM role, creates the S3 bucket, uploads the jar to the bucket. But it fails to create the lambda function itself, throwing an exception instead
com.amazonaws.services.lambda.model.InvalidParameterValueException: The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
The plugin doesn’t appear to be using the CLI itself, rather it’s using
clj-lambda which in turn is a wrapper around the AWS java sdk. But point taken, I took the latest version of that java sdk so maybe I need to walk it back.
@gonewest818: have you looked into #portkey ? I've been using it for the past few days, and 1. it's amazing, 2. the devs hangout in #portkey, and 3. they are very responsive to github issues
I always got confused with the aws configure and passing --profile switch around. It gets especially messy when working in multiple projects that involve several AWS accounts. Nowadays my workflow is that I have
.env.sh script in each project directory which exports environment variables for aws-cli (and possibly other config as well). So when I switch to a project, I cd to project folder, run
source .env and aws-cli is properly configured. Also aws-sdk will pick the configuration from environment variables when they’re set. http://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html
@qqq I will take a look. I did successfully revert the
lein-clj-lambda dependency and got my
ring-aws-lambda-adapter based lambda function uploaded and invokable. With this ring adapter I’m failing to understand (my fault, I’m skimming the docs as I go) what route gets called and how the parameters are presented in the request map, but at least I can see logs and know that the function is invokable. That’s a step ahead.
So @gonewest818 you could try just setting
Both aws-cli and aws-sdk are expected to pick config from env vars. EDIT: fixed wrong secret access key variable name
export AWS_ACCESS_KEY_ID=xxxxx export AWS_SECRET_ACCESS_KEY=yyyyy export AWS_DEFAULT_REGION=us-east-1 # or whatever region you're targeting
I tried setting those but e.g. AWS_DEFAULT_REGION was ignored and the lein plugin would throw exceptions insisting I needed to specify a region anyway. Frustrating, to say the least. So I backed up to an older version of the plugin (one that predates a commit that claimed to change region setting). It was a lucky guess, but now at least I can deploy.
Ahhh yeah was it so that aws-cli expects AWS_DEFAULT_REGION and the sdk AWS_REGION.. so you probably need to set both.
Yep, checked my own scripts and that’s how I usually have them set.
export AWS_DEFAULT_REGION=us-east-1 export AWS_REGION=$AWS_DEFAULT_REGION
@gonewest818: my minimal aws-lambda-portkey config is literally:
1. run 'aws configure' 2. (ns server.snip.aws (:require [portkey.core :as pk])) (defn h2  (str "trying again this time with boot function")) (pk/mount! h2 "/" :lambda-function-name "fn-live")