Colin J. Ihrig's Blog

Purveyor of Artisanal JavaScript

Assuming IAM Roles Using Service Accounts on Amazon EKS

EKS has a nice feature called IAM Roles for Service Accounts (IRSA) that allows Kubernetes service accounts to assume AWS IAM roles using annotations. This is nice because it allows you to avoid long-term credentials like access keys in your applications. Unfortunately, like many things on AWS, IRSA can be a bit tedious to configure properly.

Read More

Setting up MFA Using the AWS CLI

I occasionally need to setup multi-factor authentication (MFA) for AWS IAM users that have no access to the AWS web console. This happens often enough that I need to lookup the commands each time, but not often enough that I have ever written it down. That changes now.

Read More

Upcoming Changes to the Test Runner in Node 22

It's almost that time again. Node 22 is currently scheduled to be released in about a week and a half. I'd like to briefly mention some of the changes that have gone into Node's test runner (node:test) recently because they are unlikely to get called out in the official release notes.

Read More

A 2024 Wishlist for Node's Test Runner

When the Node.js test runner was initially created, it was supposed to be very minimal. Of course, developers are never happy with simple and/or minimal, so the test runner has already grown far beyond what it was ever intended to be. Since that trend seems likely to continue, I have put together a short wishlist of improvements that I would love to see in Node's test runner even though I have moved on from Node.js myself.

Read More

Refreshing Kubernetes Docker Secrets via CronJobs

In order to pull private Docker images from ECR into Kubernetes, you need to authenticate with the Docker registry. The credentials can then be stored in a Docker config secret. However, the credentials in that secret will eventually expire, leading to failures when pulling. One solution to this problem is to periodically refresh credentials via a CronJob.

Read More

Making Self-signed Certificates Work

Sometimes you need to configure HTTPS locally using a self-signed certificate. Here is a quick step by step guide. Note: this guide does not rely on "insecure" options such as curl's --insecure flag.

Read More

Quick Local Testing with the OpenTelemetry Collector

OpenTelemetry is a collection of APIs and tooling for adding tracing, metrics, and other telemetry data to applications. One of those tools is the OpenTelemetry Collector, or otelcol.

Read More

NODE_ENV Considered Harmful

At some point in the distant past, certain Node.js projects adopted the convention of using the NODE_ENV environment variable to denote how the project was being run. For example:

Read More

Deploying Private Docker Images from ECR to Kubernetes

Kubernetes allows Docker images to be pulled from arbitrary registries and spun up as pods in a cluster. Both public and private Docker registries are supported. For example, the following Deployment (copied from the Kubernetes documentation) pulls the nginx:1.14.2 image from Docker Hub. Note that a similar configuration is possible in a Pod definition.

Read More

Publishing Docker Images to ECR Private Registries

Amazon's Elastic Container Registry (ECR) is a fully managed Docker container registry. If you have ever used Docker Hub, ECR is essentially the AWS equivalent. You can push to, pull from, and otherwise interact with ECR using the Docker CLI tools.

Read More

Setting Expectations for the Node.js Test Runner

Node.js began shipping an experimental test runner starting in version 18). A year later, in Node 20, the test runner was marked stable. Since its introduction, I would say the test runner has been generally well received. I have read blog posts, interacted with users on the Node.js issue tracker, listened to conference talks and YouTube videos, and even had conversations with people in real life like the old days. I have noticed a few points that keep coming up, so I decided to write this blog post to help people set appropriate expectations for Node's test runner.

Read More

Hello world!

This is my first blog post!

Read More

AMA with the Node.js TSC

The Node.js TSC participated in an AMA recently. I was lucky enough to be one of the TSC panelists. You can read about the AMA on the OpenJS Foundation blog, or watch the full video here.

Read More

On Using `assert` as Your Assertion Library

This post is a more detailed followup to this tweet in which I advocate for using Node's assert module as your goto assertion library.

Read More

Node.js Postmortem Debugging for Fun and Production

This post originally appeared as part of JavaScript January 2018.

Read More

Node.js Profiling Using the V8 Tick Profiler

A key aspect of understanding a program's runtime behavior is identifying where it is spending its time. Generally, an application will either be waiting on I/O or performing calculations using the CPU. Node.js is excellent at handling large amounts of I/O, but must be cautious about CPU utilization because of its single threaded nature. Luckily, developers can identify, and even visualize CPU hotspots in their code using a profiler.

Read More

Developer Initiates I/O Operation. You Won't Believe What Happens Next.

As Node.js developers, we are extremely spoiled. The level of abstraction provided to us by JavaScript allows us to focus on creating interesting applications instead of wrestling with low level system concepts such as threads and synchronization. But, whether we like to think about it or not, our JavaScript code sits on top of a lot of low level code, mostly written in C/C++, as shown in the following figure. This article will trace a simple JavaScript function call as it traverses various layers of this figure. A basic understanding of the event loop is assumed. If you need an introduction or refresher, check out this guide.

Read More

Debugging Node.js with V8 Inspector

Node.js seems to increase in both popularity and sophistication on a daily basis. The project recently scored a major feature, as support for the V8 Inspector was merged into Node's master branch. This gives Node applications direct integration with DevTools, the top notch debugging tools that ship with Google Chrome. Unlike previous tools like Node Inspector, there are no required external dependencies except Chrome. The Chrome Debugging Protocol, used by V8 Inspector, can also communicate with tools from other vendors such as Microsoft and Firefox.

Read More

Verifying Node.js Binaries

The Internet is not a safe place. Sometimes, not even the simple act of downloading a file is what it seems. On February 20th 2016, hackers created a modified Linux Mint ISO containing a backdoor, and linked to it from linuxmint.com. A blog post was issued containing instructions for detecting the compromised ISO.

Read More

Node v4.0.0 - Can't you count?

In September of 2015, I gave a talk on Node v4.0.0 at the Nova Node meetup. The talk covered the road to v4, the io.js fork, convergence, what has changed, and a look into the future, including LTS. You can listen to the talk here.

Read More

NodeUp 88 - A Convergence Show

NodeUp is a popular podcast covering the Node.js community. In July of 2015, I was a guest on episode #88, which focused on the ongoing Node.js/io.js convergence process. You can listen to the entire episode here.

Read More

The Dangers of JavaScript's Automatic Semicolon Insertion

Although JavaScript is very powerful, the language's fundamentals do not have a very steep learning curve. Prior to the explosion of web applications, JavaScript was thought of as a toy language for amateur programmers. Some of JavaScript's features were specifically designed to cater to beginners. One such feature is automatic semicolon insertion. Automatic semicolon insertion is also one of JavaScript's most controversial features.

Read More