Chris Cook
zirkelc.dev
Chris Cook
@zirkelc.dev
software engineer at heart ❤️
co-founder of http://flyweight.io
aws community builder
TIL you can use `@entity.Attributes.Lambda.Function` to group messages from multiple different log groups.

Useful when you need to analyze cold starts from many Lambdas with a single cloudwatch query.
July 28, 2025 at 3:58 PM
Flow in a nutshell:
1️⃣ Lambda #1 uploads the HTML to S3 and queues requests
2️⃣ SQS FIFO for async processing and deduplication
3️⃣ Lambda #2 downloads HTML, converts to Markdown, extracts content via Bedrock and saves to Notion
July 10, 2025 at 10:47 AM
Here's Lambdalet.AI - an AI-powered bookmarking and read-it-later service. It saves any page you're reading into your own Notion database — full text, fully searchable, zero fuss.

I built this for the AWS Lambda Hackathon!
July 10, 2025 at 10:47 AM
If your using JSONata instead of JSONPath for your AWS Step Function workflow, here's how you can flatten an array of arrays:
June 18, 2025 at 7:31 AM
Found this TODO in my codebase 😄

If I make a PR, will @vitest.dev accept it? 👀
March 18, 2025 at 4:36 PM
TIL `$*` captures all positional arguments into a space separated string

You can abuse this for a Git alias to avoid typing the commit message in double quotes:

`gc my commit message`
February 2, 2025 at 8:37 AM
What if `expect(obj).toMatchPrompt("...")` was a thing

It's probably a stupid idea, but I couldn't resist and quickly implemented @vitest.dev custom matcher
January 23, 2025 at 2:44 PM
I love how you can use TypeScripts' unique symbols as a parking spot for types 👀

Here's a simple query helper function to attach the result type to an object and infer it back later

I've shared a complete example on @dev.to:

dev.to/zirkelc/uniq...
January 18, 2025 at 11:12 AM
I noticed that Vercels' popular `ms` pkg for converting time units to milliseconds uses 365.25 as a multiplier for the days in a year.

I know this is to account for leap years, but is that the right assumption to make here?

Effectively this means that `ms(1y) != ms(365d)` without ppl knowing it
January 16, 2025 at 12:34 PM
Inspired by React Query's `queryOptions()`, I made a little helper to add the type of the parameter and the return type to the query definition (yes, I know about ORM).

The next step would be to use template literal types to parse the parameters and return type from the query string.
January 15, 2025 at 10:44 AM
I released `aws-sigv4-sign` today. It contains the core logic for signing requests with AWS SigV4, but does not use the fetch API

The question now is: if you use fetch, then use `aws-sigv4-fetch`. In all other cases (axios, got, ky, node:https...) use `aws-sigv4-sign`

www.npmjs.com/package/aws-...
January 12, 2025 at 4:57 PM
@arethetypeswrong doesn't support @pnpm.io `publishConfig` to override package.json export fields when using live types

As workaround, we can run pnpm pack, extract the tarball name and pass it to @arethetypeswrong to check the types:

`pnpm pack | tail -n1 | xargs attw`

github.com/arethetypesw...
January 10, 2025 at 5:37 PM
The length of the rest args acts like a discriminator of the signature. If the function is called with one parameter it's the first signature, two parameters for the second signature, and so on.
January 4, 2025 at 12:05 PM
TypeScript Function Overloading

I used to overload functions where I merge the different parameter names and types into one implementation signature like `startOrLength`.

But it get's really messy with more than 2 params. The usage of rest args offers a really nice alternative.

/
January 4, 2025 at 12:05 PM
TIL: Vitest has a built-in option to suppress logs during tests.

I usually spy on the logger/console object and mock the implementation to disable logging during tests.

It turns out Vitest has `onConsoleLog` option to filter or even suppress logs.

vitest.dev/config/#onco...
January 2, 2025 at 12:47 PM
Looking forward to Vitest v3.
I made my first contribution with a new matcher `expect.toBeOneOf()` to check for optional properties that can be undefined or null.

main.vitest.dev/api/expect.h...
December 23, 2024 at 1:07 PM
I really like the JS-DevTools/npm-publish action for publishing npm packages from a GitHub workflow.

Just increment the package version and push it to GitHub and it will do the rest.

github.com/JS-DevTools/...
December 23, 2024 at 9:02 AM
I updated my snapshot plugin for Jest and Vitest

Now you can replace or remove multiple properties at once using arrays or regex patterns in your snapshots. Perfect for handling dynamic values like auto-generated IDs or timestamps

github.com/zirkelc/snap...
December 18, 2024 at 4:56 PM
Good idea for a Cursor rule 🤓

Inspired by @tkdodo.eu article

tkdodo.eu/blog/array-t...
December 16, 2024 at 2:40 PM
TIL: Undici uses Math.random as boundary of the FormData body

I'm working on unit tests for my AWS SignatureV4 fetch library. It tests several body types (string, Blob, Uint8, ...) but the FormData tests kept failing.

Turns out every new Request generates a random number as separator in the body
December 16, 2024 at 1:10 PM
Running a GitHub action workflow from a PR comment seems to be in high demand.

Last year, I created a sample workflow and PR that has since received more than 300 comments from a hundred different people.

github.com/zirkelc/gith...

Maybe this is something that GitHub Actions should make easier
December 15, 2024 at 10:11 AM
JSON unfortunately does not allow comments. The alternative *.jsonc (JSON with comments) is not widely accepted. For example, Biome.js accepts a biome.jsonc configuration.

A workaround is to tell VSCode to treat certain files as JSON with comments. For example, turbo.json can be treated as *.jsonc
December 14, 2024 at 9:27 AM
I updated my snapshot serializer plugin to be a bit more type safe. If the optional generic parameter T is specified, all possible keys of T are suggested for auto-completion and other keys show an error.

github.com/zirkelc/snap...
December 13, 2024 at 5:50 PM
It would be nice if there was a way to deep link into a web page, like on GitHub, where you can select any code and create a permalink.

With web pages, we only have anchors if we're lucky. CSS selectors were possible, but they break when the layout changes.
December 13, 2024 at 10:42 AM
If you are working with multiple git branches, you may have outdated dependencies because node modules are git ignored.

A git diff for the lock file can check if npm dependencies were changed in a branch.

Here is a simple post-merge git hook to automatically run npm install on git switch.
December 11, 2024 at 4:43 PM