JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 458
  • Score
    100M100P100Q111919F
  • License Apache-2.0

Interactively invoke Lambdas in Architect Sandbox with arbitrary events

Package Exports

  • @architect/plugin-lambda-invoker
  • @architect/plugin-lambda-invoker/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@architect/plugin-lambda-invoker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@architect/plugin-lambda-invoker

Interactively invoke Lambdas in Architect Sandbox with arbitrary events

GitHub CI status

Install

Into your existing Architect project:

npm i @architect/plugin-lambda-invoker --save-dev

Add the following to your Architect project manifest (usually app.arc):

@plugins
architect/plugin-lambda-invoker

Usage

While Sandbox is running, type i in your terminal to bring up the Lambda invocation menu. Then select the Lambda you'd like to invoke.

By default, this plugin will populate your menu with all @events, @queues, @scheduled, and @tables-streams; you can limit this menu (or expand it with additional pragmas) by adding the following setting to a pref[erence]s.arc file:

@sandbox
invoker http scheduled # This would populate @http + @scheduled Lambdas, and ignore all others

Tip: you can navigate the invocation menu by typing numbers (zero-indexed)!

Invocation mocks

By default, Lambdas are invoked with an empty payload ({}); if you'd like to invoke your Lambdas with arbitrary payloads, create a file containing invocation mocks.

Invocation mock files live in your root with one of these filenames: sandbox-invoke-mocks.json or sandbox-invoke-mocks.js. These files should be structured like so:

Assuming this project manifest:

@events
background-task

@queues
analytics

@scheduled
backup-database

If you wanted to add one or more mocks to each of the three Lambdas above, create the following sandbox-invoke-mocks.js (or equivalent JSON) file with the format of [pragmaName][lambdaName][mockName]:

module.exports = {
  events: {
    'background-task': {
      'my-first-mock': { /* payload */ },
      'another-mock': { /* payload */ },
    }
  },
  queues: {
    analytics: {
      'one-more-mock': { /* payload */ },
      'just-a-mock': { /* payload */ },
    }
  },
  scheduled: {
    'backup-database': {
      'a-mock-for-this': { /* payload */ },
      'the-last-mock': { /* payload */ },
    }
  },
}

Tip: when using sandbox-invoke-mocks.js, you can dynamically (synchronously) generate mocks on startup