Yandex Cloud
Search
Contact UsTry 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
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Using the invocation context
  • Authentication in the Yandex Cloud API
  • Getting the request body
  1. Developing in Node.js
  2. Invocation context

Node.js function invocation context

Written by
Yandex Cloud
Updated at March 31, 2026
  • Using the invocation context
    • Authentication in the Yandex Cloud API
    • Getting the request body

Invocation context is an object that is accepted by the request handler of a function in Node.js as the second argument.

The invocation context provides additional information about a Node.js function version properties:

  • functionFolderId: Folder containing the function.
  • functionName: Function ID.
  • functionVersion: Function version ID.
  • memoryLimitInMB: Amount of memory specified when creating the version, MB.
  • requestId: Request ID.
  • token: Parameters for authentication in the APIs of Yandex Cloud services.

The context also contains the following helper methods:

  • getRemainingTimeInMillis(): Returns the remaining time for the current request, in ms.
  • getPayload(): Returns the request body if HTTP integration is used. By default, HTTP integration is used for all function invocations if ?integration=raw is not specified.

Using the invocation contextUsing the invocation context

You can use the invocation context to authenticate with Yandex Cloud APIs and manage how the HTTP request body is retrieved.

Authentication in the Yandex Cloud APIAuthentication in the Yandex Cloud API

If you specified a service account for a function, the token parameter contains authentication information for that service account:

  • access_token: IAM token.
  • expires_in: Token lifetime in seconds.
  • token_type: Token type, e.g.,Bearer.

You can also get this information using the metadata service. For more information about this method, see Authentication from within a VM.

Getting the request bodyGetting the request body

getPayload() is a helper method that simplifies getting the request body. Depending on the content of the request body and header, the function uses different methods to process data:

  • If the request body is a JSON document and the header is Content-Type: application/json, the function returns the result of JSON.parse executed over the request body data.
  • If the request body contains form parameters and the header is Content-Type: application/x-www-form-urlencoded, the function returns the result of querystring.parse, which is an object with field keys and values.

Was the article helpful?

Previous
Request handler
Next
Logging
© 2026 Direct Cursus Technology L.L.C.