Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created March 22, 2020 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianleroux/50b588c4ff894328cd1a73be75ff19e8 to your computer and use it in GitHub Desktop.
Save brianleroux/50b588c4ff894328cd1a73be75ff19e8 to your computer and use it in GitHub Desktop.

What's the best way to invoke another function? (or get it's ARN)

reccomend using @events or @queues for 'background tasks' (events are SNS topics, unordered ans async…queues are SQS fifo queues)

is it safe to put await arc.tables() outside the event handler of a function?

you can, it will make a one time call to SSM to resolve generated table names with the names defined .arc but generally I'd reccomend keeping things deterministic as possible and doing it in the main function body

how does specifying a ddb trigger look?

define it in your .arc

@app
myapp

@tables
cats
  catID *String
  stream true

And src/tables/cats/index.js will be invoked whenever a write happens (but not locally / unfortunately dynalite doesn't support his yet)

changed my global runtime and it doesn't seem to hit the ws functions

yeah it will only take effect on new functions. you can change function runtimes in src/**/*/.arc-config … the default is nodejs12.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment