function::user_uint16 - Linux
Overview
function::user_uint16()
is a Cloud Functions Framework command for creating a new Cloud Function with a TypeScript runtime environment that accepts a uint16
parameter. User-defined Cloud Functions are event-driven, stateless, and scalable. Functions are ideal for processing data that is ephemeral and in small batches, such as processing files in Cloud Storage or log entries in Cloud Logging.
Syntax
function::user_uint16 <function-name> <http-method> <entry-point> [--handler] [--description] [--timeout] [--memory] [--runtime] [--env-vars] [--triggers]
Arguments
<function-name>
: The name of the function.<http-method>
: The HTTP method used to trigger the function. Supported methods:get
,post
,put
,delete
,patch
,head
,options
.<entry-point>
: The name of the function to be executed.
Options/Flags
--handler
: The event handler to be invoked. Defaults tohelloUint16
.--description
: A short description of the function. Defaults toA function that accepts a uint16 parameter
.--timeout
: The function execution timeout in seconds. Defaults to 60.--memory
: The function memory size in megabytes. Defaults to 256.--runtime
: The function runtime environment. Defaults tonodejs14
.--env-vars
: Environment variables to set for the function. Format:key=value
.--triggers
: Comma-separated list of events to trigger the function.
Examples
Create a new function named helloUint16
that accepts a uint16
parameter and prints it to the console:
function::user_uint16 helloUint16 get helloUint16
Create a function with a custom event handler named handleUint16
:
function::user_uint16 helloUint16 get handleUint16 --handler handleUint16
Set the function description, environment variables, and runtime:
function::user_uint16 helloUint16 get helloUint16 --description "A function that accepts a uint16 parameter and prints it to the console" --env-vars FOO=BAR --runtime nodejs16
Common Issues
Function does not respond to HTTP requests
Ensure that the function is deployed and that the entry-point
matches the function’s entry point. Verify that the function logs are not reporting any errors.
Function fails to parse uint16
parameter
Check the data type of the request parameter. The function expects a uint16
type, which is an unsigned 16-bit integer.
Integration
Functions can be chained together to perform complex tasks. For example, a function that accepts a uint16
parameter can trigger another function that processes the data further.