Comments (2)
I think the point you're raising about whether default-iam-credentials!
ought to be able to auto-retrieve the correct region from the instance metadata is a good one - though I'm not sure that's what's operative here.
If this function is running on the Lambda infrastructure, environment variables are used to convey the appropriate function role - a map containing these can be retrieved via eulalie.creds/env
- which just returns the map, not a channel, so something like:
(sns/publish-topic!
(eulalie.creds/env)
"arn:aws:sns:us-west-2:785400771354:parsehook-qa"
(.stringify js/JSON event))
Ought to work. It sounds like you may want to do something else to communicate the region (and then assoc it onto the map returned by (env)), and I'm not sure the Lambda infrastructure facilitates this. Let me know if you think there's a way to make that bit easier.
N.B. Returning an error via async-lambda-fn's channel is how errors are reported, though they may be swallowed (or obscured, at best) with nested async calls - <?
and go-catching
(or just using <?
+ (go (try ...))
) from https://github.com/nervous-systems/glossop may help with that - it's a transitive dep of your project already. There are examples of using it throughout eulalie and fink-nottle.
from cljs-lambda.
Got it working, thanks! Here's the working snippet:
(def ^:export publish-to-sns
(async-lambda-fn
(fn [event context]
(go-catching
(<! (sns/publish-topic!
(assoc (eulalie.creds/env) :region "us-west-2")
"arn:aws:sns:us-west-2:785400771354:parsehook-qa"
(.stringify js/JSON (clj->js event))))))))
from cljs-lambda.
Related Issues (20)
- Function Does Not Appear In AWS Console HOT 2
- Strategy for keywordizing keys and values? HOT 2
- How To Return JSON? HOT 2
- Posix Error running serverless deploy on windows HOT 1
- Using CLJS Lambda? HOT 4
- Weird Response In Lambda Console HOT 3
- Default Node v4.3 End-of-Life'ed HOT 4
- Cannot deploy twice HOT 2
- Update-function-configuration fails HOT 1
- If Node isn't Installed, Fails Silently
- How to Run Locally? 🤔
- How To Add Dependencies
- Error message mentions wrong file name
- Consider defaulting `:process-shim` to false in template
- Consider a lumo version HOT 6
- Does the serverless support imply support for e.g. GCP Functions, Azure Cloud Functions? HOT 2
- Use deflambda and defgateway docstring for lambda description HOT 5
- java.io.IOException: Cannot run program "aws": error=2, No such file or directory HOT 5
- Errors and Invoking Function Always Returns :errorMessage "Your magic word is garbage" HOT 4
- java.util.concurrent.ExecutionException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('V' (code 86)): Expected space separating root-level values HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cljs-lambda.