New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

serverless-console

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-console

simple console handler to run CLI commands on lambda apps

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

Serverless Console

Simple lambda handler to run CLI commands, like database migrations, create admin user, etc...

Installation

yarn install serverless-console

Usage

Setup a console file, src/console.ts.

Initiate the handler

// src/console.ts

import { serverlessConsole } from 'serverless-console';

export const handler: (command: string) => Promise<void> = serverlessConsole;

Optionally define a set of commands that are allowed

// src/console.ts

import { consoleAllowList, serverlessConsole } from 'serverless-console';

consoleAllowList(['console.log("This command is allowed.")', 'yarn --version']);

export const handler: (command: string) => Promise<void> = serverlessConsole;

Serverless example with CRON

// serverless.yml

custom:
  stage: ${opt:stage, "staging"}
  cronEnabled:
    staging: true
    prod: true

provider:
  name: aws
  runtime: nodejs20.x
  region: us-east-1
  stage: ${opt:stage, 'staging'}
  timeout: 20

functions:
  console:
    handler: src/console.handler
    events:
      - schedule:
          enabled: ${self:custom.cronEnabled.${self:custom.stage}}
          rate: rate(1 minute)
          input: 'yarn --version'

Invoke with yarn serverless invoke --function console --data "yarn --version"

FAQs

Package last updated on 21 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts