Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Functions
  • Comparison 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
  • Release notes
  • FAQ
  1. Developing in Node.js
  2. Handling errors

Node.js function error handling

Written by
Yandex Cloud
Updated at May 12, 2025

If a handler reports a Node.js function runtime or loading error, the runtime environment automatically captures the error and returns a JSON document with details of the error type, text, and location in the response. For more information about the JSON document format, see Calling a function.

The error info is also written to the execution log. You can view the log via the Yandex Cloud CLI or the management console.

Example of error handlingExample of error handling

Function code:

module.exports.handler = function () {
    return unknownVariable;
};

JSON document returned:

{
  "errorMessage": "unknownVariable is not defined",
  "errorType": "ReferenceError",
  "stackTrace": [
    ...
  ]
}

Was the article helpful?

Previous
Logging
Next
Using the SDK
Yandex project
© 2025 Yandex.Cloud LLC