Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
fun-runtimes-test
Advanced tools
Readme
Local serverless function λ development runtime.
node
).Given a Lambda function like this one:
// index.js
exports.handler = function(event, context, callback) {
callback(null, { hello: 'world' });
};
You can invoke this function locally using the code below:
const { createFunction } = require('@zeit/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 = await fn({ hello: 'world' });
console.log(res);
// Prints: { hello: 'world' }
// Once we are done with the function, destroy it so that the processes are
// cleaned up, and the API server is shut down (useful for hot-reloading).
await fn.destroy();
}
main().catch(console.error);
ƒun has a concept of pluggable "providers", which are responsible for creating, freezing, unfreezing and shutting down the processes that execute the Lambda function.
native
The native
provider executes Lambda functions directly on the machine executing
ƒun. This 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.docker
A docker
provider is planned, but not yet implemented. This will allow for an
execution environment that more closely matches the AWS Lambda environment,
including the ability to execute Linux x64 binaries / shared libraries.
ƒ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 binarypython
for Python Lambda functions using the system python
binarypython2.7
for Python Lambda functions using a downloaded Python v2.7.12 binarypython3.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 runtimesFAQs
Local Lambda development environment
We found that fun-runtimes-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).