GithubHelp home page GithubHelp logo

Comments (2)

moea avatar moea commented on May 31, 2024

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.

keeth avatar keeth commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.