package
Local Lambda development environment
npm install @vercel/funGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Local serverless function λ development runtime.
Given a Lambda function like this one:
// example/index.js
exports.handler = function(event, context, callback) {
callback(null, { hello: 'world' });
};You can invoke this function locally using the code below:
import { createFunction } from '@vercel/fun';
async function main() {
// Starts up the necessary server to be able to invoke the function
const fn = await createFunction({
Code: {
// `ZipFile` works, or an already unzipped directory may be specified
Directory: __dirname + '/example'
},
Handler: 'index.handler',
Runtime: 'nodejs8.10',
Environment: {
Variables: {
HELLO: 'world'
}
},
MemorySize: 512
});
// Invoke the function with a custom payload. A new instance of the function
// will be initialized if there is not an available one ready to process.
const res =
ƒun provides an execution environment that closely resembles the real Lambda environment, with some key differences that are documented here:
sbx_user1051 user./var/task, /var/runtime, /opt, etc. Instead, your
function code should use the environment variables that represent these
locations (namely LAMBDA_TASK_ROOT and LAMBDA_RUNTIME_DIR).SIGSTOP signal to the lambda process,
and unfrozen by sending the SIGCONT signal, not using the cgroup freezer.ƒun aims to support all runtimes that AWS Lambda provides. Currently implemented are:
nodejs for Node.js Lambda functions using the system node binarynodejs6.10 for Node.js Lambda functions using a downloaded Node v6.10.0 binarynodejs8.10 for Node.js Lambda functions using a downloaded Node v8.10.0 binarynodejs10.x for Node.js Lambda functions using a downloaded Node v10.15.3 binarynodejs12.x for Node.js Lambda functions using a downloaded Node v12.22.7 binarynodejs14.x for Node.js Lambda functions using a downloaded Node v14.18.1 binarypython for Python Lambda functions using the system python binarypython2.7 for Python Lambda functions using a downloaded Python v2.7.12 binarypython3 for Python Lambda functions using the system python3 binary (or fallback to python)python3.6 for Python Lambda functions using a downloaded Python v3.6.8 binarypython3.7 for Python Lambda functions using a downloaded Python v3.7.2 binarygo1.x for Lambda functions written in Go - binary must be compiled for your platformprovided for custom runtimesexecutable for executables that are powered by Fluid computematt.straka
matt.j.straka@gmail.com
Estimated unpacked size across 38 packages.
4.5 MB
Includes dependencies.
2.6.7
3.3.2
1.0.0
2.0.5
1.2.0
3.1.0
3.4.2
3.9.0
5.1.0
8.3.0
2.1.3
4.0.0
8.4.2
9.0.0
2.0.1
3.0.1