🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

serverless-shell

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-shell

Serverless Shell with env vars Plugin

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
2
Created
Source

United Income at Capital One created this project with the intention of it helping us with Serverless Framework development and debugging. We have stopped providing updates to this project and archived it as of September 30th, 2021.

Serverless Shell

serverless npm

A Serverless v1.x plugin to drop to a local shell with your environment variables from serverless.yml.

Install

npm install --save serverless-shell

Add the plugin and set some env vars in your serverless.yml:

provider:
  name: aws
  environment:
    SOME_VAR: foobar
plugins:
  - serverless-shell

Usage

Example in a python project

$ serverless shell
Serverless: Spawning python3.6...
Python 3.6.1 (default, Mar 22 2017, 06:17:05) 
[GCC 6.3.0 20170321] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['SOME_VAR']
'foobar'

and in a NodeJS project:

$ serverless shell
Serverless: Spawning node...
> process.env.SHELL
'foobar'

Per function & stage specific env vars

Since the main reason for building this was to test code with the configs for various stages, it supports properly building the environment. For example:

$ serverless -s staging shell -f status

Custom shell (babel) support

If you want to launch a different shell than the runtime's default, you can specify that with in the custom section of your config. This can be used to for things like using babel-node instead of node or even dropping to bash with the right env vars set.

Example:

  custom:
    shellBinary: babel-node

This feature can also be activated by a CLI switch:

$ sls shell -S bash

Keywords

serverless

FAQs

Package last updated on 29 Sep 2021

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