After years of reviewing codebases and debugging mysterious production issues at Cloudflare, I’ve become somewhat of a Promise detective. One pattern I’ve seen repeatedly causing headaches is improper Promise handling. It’s 2 AM, and I’m staring at logs from a serverless function that mysteriously failed in production - all because someone forgot to await a Promise. Again.…
Ever had that moment when you realize your plant parenting skills need a tech upgrade? That’s exactly where I found myself when I started growing a citrus plant with a thirst that seemed unquenchable. So, I decided to build a system that could help me keep track of the plant’s water needs by monitoring the soil moisture levels using a Raspberry Pi, a soil moisture sensor, and some rust…
When working with PostgreSQL and Elixir’s Ecto ORM, you are likely using SERIAL columns for auto-incrementing primary keys. However, since PostgreSQL 10 (released in October 2017), there’s a better way: IDENTITY columns. Why Identity Columns? Identity columns (GENERATED AS IDENTITY) are part of the SQL Standard and are the recommended approach for auto-incrementing keys in modern…
Introduction LIMIT / OFFSET pagination is one of the most common ways to implement pagination in your service. You can find countless tutorials online describing the method and its even the default in the popular web framework Django1. While it gets the job done for most use cases and smaller tables, you may begin to run into performance issues when paginating tables with millions of rows. Django…
Preface If you are just hearing about Terraform for the first time, the introduction to this post attempts to outline all the necessary information to get up to speed. For the already initiated, feel free to skim through the introduction before diving into the details of creating your own HTTP Terraform Backend on Cloudflare Workers. Introduction to Terraform Terraform is a popular open-source…
Update 2022-09-16: After publishing this post I’ve received a few comments saying it is against Cloudflare ToS to stream video using Cloudflare Tunnels. 2.8 Limitation on Serving Non-HTML Content The Services are offered primarily as a platform to cache and serve web pages and websites. Unless explicitly included as part of a Paid Service purchased by you, you agree to use the Services…
As a developer you may have come across the site httpbin.org. The purpose of the website is to provide a simple request and response service. For example, issuing a simple HTTP GET request “echos” back the request as the response, using JSON as the format. curl https://httpbin.org/get { 'args': {}, 'headers': { 'Accept': '*/*', 'Host': 'httpbin.org', 'User-Agent': 'curl/7.79.1', },…
Introduction Holster is a monorepo containing a collection of Cloudflare Workers written in TypeScript and managed using Lerna. In this post I’ll go through the structure of the repo and why I decided to go with a monorepo. In future posts I hope to write about the all the individual Workers I maintain in the repo. Project Layout The layout of the project consists of the common set of files…