-
Notifications
You must be signed in to change notification settings - Fork 115
Home
Disclaimer: This is not an official Google product.
Table of Contents
- What is this?
- How do I get started?
-
Where is the documentation?
- CLI Docs:
functions --help
- How-To Guides
- CLI Docs:
The Google Cloud Functions Emulator is a Node.js application that implements the Google Cloud Functions API, and includes a CLI with which it can be managed.
The Emulator allows you to deploy, run, and debug your Cloud Functions on your local machine before deploying them to the production Google Cloud Functions service.
-
(Optional, but recommended) Sign up for the Google Cloud Functions Alpha and explore the Cloud Functions Documentation.
-
Write a function:
mkdir helloworld cd helloworld touch index.js echo 'exports.helloWorld = (req, res) => res.send("Hello, World!");' > index.js
-
Install the Emulator:
NPM:
npm install -g @google-cloud/functions-emulator
Yarn:
yarn global add @google-cloud/functions-emulator
Or read more in the detailed installation instructions.
-
Start the Emulator:
functions start
Get help starting the Emulator with
functions start --help
. -
Deploy your function:
functions deploy helloWorld --trigger-http
Get help deploying a function with
functions deploy --help
. -
Call your function:
functions call helloWorld
Get help calling a function with
functions call --help
. -
View the logs:
functions logs read
Get help reading logs with
functions logs read --help
.
For a quick reference, the Emulator CLI is self-documenting. Run the following to get help with the CLI:
functions --help
For everything else see the How-To Guides.
Disclaimer: This is not an official Google product.
@google-cloud/functions-emulator is currently in pre-1.0.0 development. Before the 1.0.0 release, backwards compatible changes and bug fixes will bump the patch version number and breaking changes will bump the minor version number.