LocalCloud Cloud Functions (2nd Gen) Local Emulator
Get started
local.cloud — Cloud Functions (2nd Gen) Local Emulator .md Open tab

Cloud Functions (2nd Gen)

Cloud Functions runs functions in response to HTTP requests or events. LocalCloud stores function metadata and routes supported invocations to a handler you run locally.

When to use Cloud Functions (2nd Gen)

Typical uses

Use when a small handler processes an HTTP request or event and can run as an independently invoked function. Locally, test routing to your own running handler.

Examples

  • HTTP function handlers
  • Pub/Sub-triggered application logic
Compute & Runtime

Explore another service

View all
Local workflow

Example usage

Install the CLI, start LocalCloud, and export its environment in the same shell. Generated endpoints account for remapped ports.

1. Install and start · shell
curl -fsSL https://local.cloud/install.sh | sh
localcloud start --local-only
# Export GOOGLE_CLOUD_PROJECT and CLOUD_FUNCTIONS_EMULATOR_HOST
eval "$(localcloud env)"

Exercise an HTTP function handler

  1. Run the handler in your own local process.
  2. Register function metadata with its execution target.
  3. Invoke through LocalCloud and assert the handler response.

Documented workflows

  • Second-generation function metadata CRUD
  • HTTP forwarding and Pub/Sub trigger routing

Service boundaries

  • Requires your own execution target
  • No source builds or managed function containers
  • No Firestore/Storage/Audit Log Eventarc triggers or Google identity tokens
Try it in your project

Code examples and integrations

Start with the local guides. Official Google Cloud samples may need endpoint changes and can cover features outside the workflows listed here.

Agent testing

Use Cloud Functions (2nd Gen) with an AI agent

Before the agent changes application logic, have it create local Cloud Functions (2nd Gen) state, read it back with the project SDK, and note which feature the check covered. That first local call catches accidental production routing and needs no GCP account, service-account key, or billing project.

Configure this repo

Set up this repository to use LocalCloud for local GCP development. First read https://local.cloud/ai/agents.md, then inspect this repo, identify the GCP services and SDK language, configure emulator environment variables, and run the narrowest integration test against localhost. Do not use real GCP credentials or production endpoints.

Production endpoints, auth, IAM, quotas, regional behavior, and final release validation still need the target Google Cloud project.

Agent resources has more prompts and the AGENTS.md template.

Related guides

Desktop view