Node.js Serverless Functions on Red Hat OpenShift, Part 2: Debugging Locally

Node.js Serverless Functions on Red Hat OpenShift, Part 2: Debugging Locally

Learn how to run and debug Node.js applications locally with Visual Studio Code, in Part 2 of this series on Node.js serverless functions. Node.js serverless functions on Red Hat OpenShift, Part 2: Debugging locally.

Welcome back to our series on using serverless functions on  Red Hat OpenShift. The previous article introduced you to  how logging works in Node.js and how to customize what is logged in a Node.js function application. Now, we'll take a look at how to debug  Node.js function-based applications. Because debugging is a longer topic, we'll cover it in two parts. This article walks through how to set up and debug function applications locally with Visual Studio Code (VS Code). The next article will show you how to connect and debug function applications running in a container on a cluster.

Note: For an introduction to logging function-based applications, see Node.js serverless functions on Red Hat OpenShift, Part 1: Logging. For an overview of Red Hat OpenShift Serverless Functions, see Create your first serverless function with Red Hat OpenShift Serverless Functions.


To follow along with this article, you will need to install Node.js and download the example application from  GitHub. We'll also use  VS Code for its easy-to-use built-in debugger.

As with the  previous article, we scaffolded this function application with the kn func command-line interface (CLI) tool. If you are not already familiar with it, you can learn more by reading Create your first serverless function with Red Hat OpenShift Serverless Functions.

Setting up the function application in Visual Studio Code

Use Git to clone the  example repository and then open it up in VS Code. We can see that this Node.js function application is just like any other Node.js application, with an index.js file where the main function logic is located.

Before we continue, let's put a breakpoint right around line 30, which is inside the invoke function (see Figure 1).


What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Serverless Applications - Pros and Cons to Help Businesses Decide - Prismetric

Businesses need to understand serverless application with major pros and cons of serverless architecture, before deciding about serverless computing.

Overcoming Common Serverless Challenges with Mainframe CICS Programs

Bypass the complex middleware and consider a lightweight node.js implementation to deploy serverless functions from your mainframe CICS applications.

Top 5 Serverless Trends in 2020

Happy Serverless September 2020! We at Coding Sans love working with serverless technology. This is why we decided to publish a report with the latest serverless trends this year. We partnered up with nine other companies who share our love to make it happen.

Predicting The Cost and Performance of Serverless Workloads Under Different Workload

In this post, I will go through the process of predicting key performance characteristics and the cost of scale-per-request serverless platforms (like AWS Lambda, IBM Cloud Functions, Azure Functions, and Google Cloud Functions) with different workload intensities (in terms of requests per second) using a performance model.

Going Serverless With Oracle Stored Procedures

Serverless computing promises greater scalability, faster development, more efficient deployment, and lower cost.