Functions Framework for Ruby

The Functions Framework is an open source framework for writing lightweight, portable Ruby functions that run in a serverless environment. Functions written to this Framework will run in many different environments, including:

The framework allows you to go from:

FunctionsFramework.http("hello") do |request|
  "Hello, world!\n"


curl http://my-url
# Output: Hello, world!

Running on a fully-managed or self-managed serverless environment, without requiring an HTTP server or complicated request handling logic.


  • Define named functions using normal Ruby constructs.
  • Invoke functions in response to requests.
  • Automatically unmarshal events conforming to the CloudEvents spec.
  • Automatically convert most legacy events from Google Cloud services such as Cloud Pub/Sub and Cloud Storage, to CloudEvents.
  • Spin up a local development server for quick testing.
  • Integrate with standard Ruby libraries such as Rack and Minitest.
  • Portable between serverless platforms.
  • Supports all non-end-of-life versions of Ruby.

Supported Ruby versions

This library is supported on Ruby 2.5+.

Google provides official support for Ruby versions that are actively supported by Ruby Core—that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Currently, this means Ruby 2.5 and later. Older versions of Ruby may still work, but are unsupported and not recommended. See for details about the Ruby support schedule.


Here is how to run a Hello World function on your local machine.

Create a Gemfile listing the Functions Framework as a dependency:

# Gemfile
source ""
gem "functions_framework", "~> 0.9"

Create a file called app.rb and include the following code. This defines a simple function called "hello".

# app.rb
require "functions_framework"

FunctionsFramework.http("hello") do |request|
  "Hello, world!\n"

Install the bundle, and start the framework. This spins up a local web server running your "hello" function:

bundle install
# ...installs the functions_framework gem and other dependencies
bundle exec functions-framework-ruby --target hello
# ...starts the functions server in the foreground

In a separate shell, you can send requests to this function using curl:

curl http://localhost:8080
# Output: Hello, world!

Stop the server with CTRL+C.


These guides provide additional getting-started information.

The library reference documentation can be found at:

Additional examples are available in the GitHub repository:


The source for the Ruby Functions Framework is available on GitHub at For more information on the Functions Framework contract implemented by this framework, as well as links to Functions Frameworks for other languages, see

The Functions Framework is open source under the Apache 2.0 license. Contributions are welcome. Please see the contributing guide at

Report issues at