Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Functions
  • Comparing with other Yandex Cloud services
    • Overview
    • Managing dependencies
    • Request handler
    • Logging
    • Error handling
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ
  1. Developing in Bash
  2. Request handler

Handler script for Bash function calls

Written by
Yandex Cloud
Updated at July 2, 2026
View in Markdown

A request handler script is called to handle each invocation of a function in Bash. When creating a function version, you must specify the entry point, i.e., the extension file name, e.g., handler.sh.

The runtime delivers the request body in JSON format to the script via stdin.

The script stores service information in these environment variables:

  • REQUEST_ID: Request ID.
  • FUNCTION_NAME: Function ID.
  • FUNCTION_VERSION: Function version ID.

After processing, the function returns the stdout contents in JSON format.

ExamplesExamples

The following function outputs the request structure and environment variables to both the execution log and function response:

#!/bin/bash
set -e

RESPONSE=$(cat | jq -sc '.[0] // {}' | jq -c '{statusCode:200, body:{env:env, request:.}}')
echo $RESPONSE >&2
echo $RESPONSE | jq -c '.body |= tostring' # make sure 'body' is a string, not a json node

Was the article helpful?

Previous
Managing dependencies
Next
Logging
© 2026 Direct Cursus Technology L.L.C.