Adventures in Nodeland logo

Adventures in Nodeland

Subscribe
Archives
September 27, 2021

Too many Fastify releases and other Adventures in Nodeland - Issue #28

Hi Everyone,

What happen in Nodeland last week? Plenty! I’m currently very busy on Pino, NodeConf, a few Node.js improvements and a few Fastify releases as I botched a change a couple of weeks ago. Interested? Read through!

Only 3 weeks to NodeConf! Are you ready? Sign up, it’s going to be amazing!

NodeConf Remote · Europe's largest Node.js conference
NodeConf Remote · Europe's largest Node.js conference
NodeConf Remote brings speakers and devs from across the globe together for 4 full days of talks and workshops centred around the Node.js framework.
www.nodeconfremote.com
NodeConf Remote · Europe's largest Node.js conference
NodeConf Remote · Europe's largest Node.js conference
NodeConf Remote brings speakers and devs from across the globe together for 4 full days of talks and workshops centred around the Node.js framework.
www.nodeconfremote.com

Node.js

We recently shipped a new release of Undici to fix a few outstanding issues and introduce support for diagnostics_channel. This new feature will underpin how Application Performance Management (APM) software will instrument Undici without the need of monkeypatching:

Release v4.7.0 · nodejs/undici · GitHub
Release v4.7.0 · nodejs/undici · GitHub
An HTTP/1.1 client, written from scratch for Node.js - Release v4.7.0 · nodejs/undici
github.com
Release v4.7.0 · nodejs/undici · GitHub
Release v4.7.0 · nodejs/undici · GitHub
An HTTP/1.1 client, written from scratch for Node.js - Release v4.7.0 · nodejs/undici
github.com

If you are interested about Node.js streams, read this issue as it clarifies a few interesting points:

Readable event triggers but socket.readableLength returns zero · Issue #40136 · nodejs/node · GitHub
Readable event triggers but socket.readableLength returns zero · Issue #40136 · nodejs/node · GitHub
Version 16.4.2 Platform Windows 10 Subsystem No response What steps will reproduce the bug? I am reading specific lengths of data off the readable queue. I check the readableLength to determine how much data I can read. However, there ar…
github.com
Readable event triggers but socket.readableLength returns zero · Issue #40136 · nodejs/node · GitHub
Readable event triggers but socket.readableLength returns zero · Issue #40136 · nodejs/node · GitHub
Version 16.4.2 Platform Windows 10 Subsystem No response What steps will reproduce the bug? I am reading specific lengths of data off the readable queue. I check the readableLength to determine how much data I can read. However, there ar…
github.com

Pino

We keep pursuing the release of Pino@7.0.0 and we are relatively close to finalize the release. There was some good activity on sonic-boom, making it more solid and easier to control the memory used for buffering.

Throws error if minLengh >= MAX_WRITE by leorossi · Pull Request #106 · pinojs/sonic-boom · GitHub
Throws error if minLengh >= MAX_WRITE by leorossi · Pull Request #106 · pinojs/sonic-boom · GitHub
Fixes: #100
github.com
Throws error if minLengh >= MAX_WRITE by leorossi · Pull Request #106 · pinojs/sonic-boom · GitHub
Throws error if minLengh >= MAX_WRITE by leorossi · Pull Request #106 · pinojs/sonic-boom · GitHub
Fixes: #100
github.com
Add retryEAGAIN callback function by mmarchini · Pull Request #95 · pinojs/sonic-boom · GitHub
Add retryEAGAIN callback function by mmarchini · Pull Request #95 · pinojs/sonic-boom · GitHub
Add a synchronous callback for when we encounter EAGAIN errors. The function must return true or false to inform sonic-boom if it should continue retrying or if it should bubble up the error it encounters.
github.com
Add retryEAGAIN callback function by mmarchini · Pull Request #95 · pinojs/sonic-boom · GitHub
Add retryEAGAIN callback function by mmarchini · Pull Request #95 · pinojs/sonic-boom · GitHub
Add a synchronous callback for when we encounter EAGAIN errors. The function must return true or false to inform sonic-boom if it should continue retrying or if it should bubble up the error it encounters.
github.com

On the pino front, there has been an interesting discussion on dropped logs in certain condition when using the new transport features. However without a clear way to reproduce it is hard to know if we ever fix it…

Pino.transport seems to be dropping logs? · Issue #1138 · pinojs/pino · GitHub
Pino.transport seems to be dropping logs? · Issue #1138 · pinojs/pino · GitHub
Thanks for the fantastic library and documentation! I’ve been happily using it for a few years, and this is the first meaningful issue I’ve had (after upgrading from pino@6.11.3 +pino-multi-stream@5.3.0 to pino@7.0.0-rc.6 – hopefully I’m…
github.com
Pino.transport seems to be dropping logs? · Issue #1138 · pinojs/pino · GitHub
Pino.transport seems to be dropping logs? · Issue #1138 · pinojs/pino · GitHub
Thanks for the fantastic library and documentation! I’ve been happily using it for a few years, and this is the first meaningful issue I’ve had (after upgrading from pino@6.11.3 +pino-multi-stream@5.3.0 to pino@7.0.0-rc.6 – hopefully I’m…
github.com

…anyway I did my best attempt with the following PR. The problem was quite interesting and due to an old wart of Node.js streams when they are piped into each other. Luckily in this case I could just remove it:

Remove in-between Transform for file.js by mcollina · Pull Request #1140 · pinojs/pino · GitHub
Remove in-between Transform for file.js by mcollina · Pull Request #1140 · pinojs/pino · GitHub
I have been investigating #1138 for dropped logs, and I found some during process shutdown. Specifically, it is due to the Transform stream emitting close while the destination was still shutting down. We would need some better mechanism to signal pino “the whole pipeline has been shutdown”.
github.com
Remove in-between Transform for file.js by mcollina · Pull Request #1140 · pinojs/pino · GitHub
Remove in-between Transform for file.js by mcollina · Pull Request #1140 · pinojs/pino · GitHub
I have been investigating #1138 for dropped logs, and I found some during process shutdown. Specifically, it is due to the Transform stream emitting close while the destination was still shutting down. We would need some better mechanism to signal pino “the whole pipeline has been shutdown”.
github.com

Fastify

My sequence of botched Fastify releases continued. Last week I ended up releasing Fastify v3.21.4, .5 and .6 to finally fix all the regressions introduced by a seemingly innocuous fix. I’m afraid we need to integrate some regression testing on as many official plugins we can muster soon, similar to what Node.js does with its CITGM project.

Release v3.21.4 · fastify/fastify · GitHub
Release v3.21.4 · fastify/fastify · GitHub
github.com
Release v3.21.4 · fastify/fastify · GitHub
Release v3.21.4 · fastify/fastify · GitHub
github.com
Release v3.21.5 · fastify/fastify · GitHub
github.com
Release v3.21.6 · fastify/fastify · GitHub
github.com

As you probably know, I’m not a fan of Jest. However many of you are and this blog post is going to be very helpful on how to integrate it with Fastify.

Set up an Async Fastify App with Jest
Proof of concept to test a Fastify App which uses asynchronous plugins.
zentered.co

How would you write an OAuth 2.0 authorization server with Fastify? You don’t, because it is already implemented for you by Jason:

Release v2.0.0 Fastify! · jasonraimondi/ts-oauth2-server · GitHub
Release v2.0.0 Fastify! · jasonraimondi/ts-oauth2-server · GitHub
A standards compliant implementation of an OAuth 2.0 authorization server for Node that utilizes JWT and Proof Key for Code Exchange (PKCE), written in TypeScript. - Release v2.0.0 Fastify! · jasonraimondi/ts-oauth2-server
github.com
Release v2.0.0 Fastify! · jasonraimondi/ts-oauth2-server · GitHub
Release v2.0.0 Fastify! · jasonraimondi/ts-oauth2-server · GitHub
A standards compliant implementation of an OAuth 2.0 authorization server for Node that utilizes JWT and Proof Key for Code Exchange (PKCE), written in TypeScript. - Release v2.0.0 Fastify! · jasonraimondi/ts-oauth2-server
github.com

Articles

Do you think that Rust is the future of JavaScript? The team at Rome bets on this.

Rome will be written in Rust 🦀
Rome will be written in Rust 🦀
For the JavaScript and Web communities, these responsibilities have often been split between many different tools, which causes everyone to implement the same things in slightly different ways over and over.
rome.tools

As part of my new role of Chief Software Architect I will have to oversee all of the Developer Relations activities that we do at NearForm. How do you measure them? Check out this article by swyx:

Measuring Developer Relations ∊ swyx.io
Measuring Developer Relations ∊ swyx.io
DevRel is hot but nobody knows how to measure it. That’s because we don’t agree on what effective DevRel is, and we don’t agree on the tradeoffs of lagging vs leading metrics for a creative, unattributable, intimately human endeavor.
www.swyx.io
Measuring Developer Relations ∊ swyx.io
Measuring Developer Relations ∊ swyx.io
DevRel is hot but nobody knows how to measure it. That’s because we don’t agree on what effective DevRel is, and we don’t agree on the tradeoffs of lagging vs leading metrics for a creative, unattributable, intimately human endeavor.
www.swyx.io

As you might know, I’m incredibly interested in GraphQL-based architecture for the enterprise. Check out this article about how IMDB implemented theirs:

Building federated GraphQL on AWS Lambda | Amazon Web Services
Building federated GraphQL on AWS Lambda | Amazon Web Services
This post is written by Krzysztof Lis, Senior Software Development Engineer, IMDb. IMDb is the world’s most popular source for movie, TV, and celebrity content. It deals with a complex business domain including movies, shows, celebrities, industry professionals, events, and a distributed ownership model.
aws.amazon.com
Building federated GraphQL on AWS Lambda | Amazon Web Services
Building federated GraphQL on AWS Lambda | Amazon Web Services
This post is written by Krzysztof Lis, Senior Software Development Engineer, IMDb. IMDb is the world’s most popular source for movie, TV, and celebrity content. It deals with a complex business domain including movies, shows, celebrities, industry professionals, events, and a distributed ownership model.
aws.amazon.com

Last weekend I was scrolling twitter and my eyes stumbled on this article about parenthood: I feel I’m significantly more at the risk of burnout than before. Read up the story of Elena, there is much we could be better at:

I just don’t want to be busy anymore
I just don’t want to be busy anymore
I work in tech, I’m a parent, and I’m struggling with burnout. If I’m honest, I’ve been running on fumes for a while. But there were enough milestones along the way to keep chasing that next moment of reprieve.
elenasalaks.medium.com
Don't miss what's next. Subscribe to Adventures in Nodeland:
GitHub X YouTube LinkedIn