Adventures in Nodeland logo

Adventures in Nodeland

Subscribe
Archives
January 24, 2022

Adventures in Nodeland - Issue #44

Hi Everyone! This edition includes a massive list of changes that have been worked on in the last weeks in Fastify and Pino. Thanks to our fantastic community, we have been able to ship all this work! This edition also feature a few articles covering OSS sustainability, Remix, and a few other very interesting takes. Enjoy!

This week I will be speaking at JS Poland about Fastify! Tune in at:

JS Poland - International JavaScript Conference – 26 January 2022 – Warsaw, PL
JS Poland - International JavaScript Conference – 26 January 2022 – Warsaw, PL
1 days - 1 tracks - 25 speakers - 1000+ developers
js-poland.pl
JS Poland - International JavaScript Conference – 26 January 2022 – Warsaw, PL
JS Poland - International JavaScript Conference – 26 January 2022 – Warsaw, PL
1 days - 1 tracks - 25 speakers - 1000+ developers
js-poland.pl

Next week I will be part of the GraphQL meetup hosted by Prisma, join up:

GraphQL Berlin Meetup #25 - an online event + a raffle! 🎁 | Meetup
GraphQL Berlin Meetup #25 - an online event + a raffle! 🎁 | Meetup
mar 1 feb 2022, 18:00: Tune in for the 25th edition of the GraphQL Berlin Meetup! 🤗 Connect with the GraphQL enthusiasts worldwide, get inspired by the talks, join the Q&A session and win prizes in t
www.meetup.com
GraphQL Berlin Meetup #25 - an online event + a raffle! 🎁 | Meetup
GraphQL Berlin Meetup #25 - an online event + a raffle! 🎁 | Meetup
mar 1 feb 2022, 18:00: Tune in for the 25th edition of the GraphQL Berlin Meetup! 🤗 Connect with the GraphQL enthusiasts worldwide, get inspired by the talks, join the Q&A session and win prizes in t
www.meetup.com

Fastify

We have recently added the go-to guide for Prototype Poisoning to Fastify docs. This is an old article from Eran Hammer. It is a must read for all JS developers.

Prototype-Poisoning
Prototype-Poisoning
The following is an article written by Eran Hammer. It is reproduced here for posterity with permission. It has been reformatted from the original HTML source to Markdown source, but otherwise remains the same.
www.fastify.io

fastify-cli@2.15.0 include a new test helper that was developed by Manuel Spigolon. Check it out:

Release v2.15.0 · fastify/fastify-cli
Release v2.15.0 · fastify/fastify-cli
Compare 📚 PR: • chore(deps): bump fastify/github-action-merge-dependabot (#437)
github.com

As with every new releases, our users have found a significant regression in fast-json-stringify v3 (which will be part of Fastify v4): a memory leak due to some internal changes in Ajv. Fellow collaborator Mohamed Edrah diagnosed the problem and fixed it fairly quickly with a brilliant solution that also yield significant performance increase for that use case.

Use `ajv.addSchema` to load validation schemas at build by MSE99 · Pull Request #382 · fastify/fast-json-stringify · GitHub
Use `ajv.addSchema` to load validation schemas at build by MSE99 · Pull Request #382 · fastify/fast-json-stringify · GitHub
Checklist
run npm run test and npm run benchmark tests and/or benchmarks are included documentation is changed or added commit message and code follows the Developer’s Certification of Origin and the Code of conduct
Uses ajv.addSchema to load all validation schemas while building the code instead of serializing the schema to an object literal that is eventually passed ajv.validate. Could fix the memory leak discussed in #379
github.com
Use `ajv.addSchema` to load validation schemas at build by MSE99 · Pull Request #382 · fastify/fast-json-stringify · GitHub
Use `ajv.addSchema` to load validation schemas at build by MSE99 · Pull Request #382 · fastify/fast-json-stringify · GitHub
Checklist
run npm run test and npm run benchmark tests and/or benchmarks are included documentation is changed or added commit message and code follows the Developer’s Certification of Origin and the Code of conduct
Uses ajv.addSchema to load all validation schemas while building the code instead of serializing the schema to an object literal that is eventually passed ajv.validate. Could fix the memory leak discussed in #379
github.com

A few weeks ago, AWS shipped a new feature that enables Lamba Functions written in JavaScript to leverage the asynchronous initialization of ESM modules to massively reduce cold start for lambdas with provisioned capacity (-94%). Check it out:

Migrate to ESM and reduce cold start by preloading the fastify instance · Issue #89 · fastify/aws-lambda-fastify
Migrate to ESM and reduce cold start by preloading the fastify instance · Issue #89 · fastify/aws-lambda-fastify
github.com
Migrate to ESM and reduce cold start by preloading the fastify instance · Issue #89 · fastify/aws-lambda-fastify
Migrate to ESM and reduce cold start by preloading the fastify instance · Issue #89 · fastify/aws-lambda-fastify
github.com

Have you ever heard of Turborepo? It’s an all-in-one solution to reduce the install time of modules in monorepos. Interestingly, they were acquired by Vercel which made the client Open Source while there is a server counterpart that is so proprietary. Fastify collaborator Maksim recently built an open source version of it using your favorite framework… check it out!

GitHub - fox1t/turborepo-remote-cache: open-source implementation of the Turborepo custom remote cache server.
GitHub - fox1t/turborepo-remote-cache: open-source implementation of the Turborepo custom remote cache server.
This project is an open-source implementation of the .
github.com
GitHub - fox1t/turborepo-remote-cache: open-source implementation of the Turborepo custom remote cache server.
GitHub - fox1t/turborepo-remote-cache: open-source implementation of the Turborepo custom remote cache server.
This project is an open-source implementation of the .
github.com

Fastify v3.26.0 is out! We have a few new features, including a typescript regression fix, better support for the plugin names and many docs updates and other fixes.

Release v3.26.0 · fastify/fastify · GitHub
Release v3.26.0 · fastify/fastify · GitHub
github.com
Release v3.26.0 · fastify/fastify · GitHub
Release v3.26.0 · fastify/fastify · GitHub
github.com

Shortly after Fastify v3.26.0 was released, I realized I released too soon as the PR from James Sumners got finished. This change add a new option to Fastify to make the .close method automatically destroy all connected sockets. This behavior is very useful because it allows a very quick shutdown of the server. It’s not enabled by default because it introduces some overhead when in use. Check it out:

Add keep-alive connection tracking and reaping (resolve #3617) by jsumners · Pull Request #3619 · fastify/fastify · GitHub
Add keep-alive connection tracking and reaping (resolve #3617) by jsumners · Pull Request #3619 · fastify/fastify · GitHub
github.com
Add keep-alive connection tracking and reaping (resolve #3617) by jsumners · Pull Request #3619 · fastify/fastify · GitHub
Add keep-alive connection tracking and reaping (resolve #3617) by jsumners · Pull Request #3619 · fastify/fastify · GitHub
github.com

This new feature was then released as the only change in v3.27.0. Integers are cheap, so I just released a new minor version straight away. You can safely skip v3.26.0.

Release v3.27.0 · fastify/fastify · GitHub
Release v3.27.0 · fastify/fastify · GitHub
github.com
Release v3.27.0 · fastify/fastify · GitHub
Release v3.27.0 · fastify/fastify · GitHub
github.com

Pino

Following up on a huge demand from Jest users, we added a sync flag to pino-pretty so it could be configured to make all its logging synchronous. Why it benefits Jest? Because it tracks all open handles and any asynchronous logging would result in a warning ⚠️. Enjoy!

Add support for sync: true as option by mcollina · Pull Request #297 · pinojs/pino-pretty · GitHub
Add support for sync: true as option by mcollina · Pull Request #297 · pinojs/pino-pretty · GitHub
Fixes: #296
github.com
Add support for sync: true as option by mcollina · Pull Request #297 · pinojs/pino-pretty · GitHub
Add support for sync: true as option by mcollina · Pull Request #297 · pinojs/pino-pretty · GitHub
Fixes: #296
github.com

We shipped the above new feature together with the additional prettifiers metadata https://github.com/pinojs/pino-pretty/pull/283 and many others

Release v7.4.0 · pinojs/pino-pretty · GitHub
Release v7.4.0 · pinojs/pino-pretty · GitHub
🌲Basic prettifier for Pino log lines. Contribute to pinojs/pino-pretty development by creating an account on GitHub.
github.com
Release v7.4.0 · pinojs/pino-pretty · GitHub
Release v7.4.0 · pinojs/pino-pretty · GitHub
🌲Basic prettifier for Pino log lines. Contribute to pinojs/pino-pretty development by creating an account on GitHub.
github.com

We

Release v7.5.0 · pinojs/pino-pretty · GitHub
Release v7.5.0 · pinojs/pino-pretty · GitHub
🌲Basic prettifier for Pino log lines. Contribute to pinojs/pino-pretty development by creating an account on GitHub.
github.com
Release v7.5.0 · pinojs/pino-pretty · GitHub
Release v7.5.0 · pinojs/pino-pretty · GitHub
🌲Basic prettifier for Pino log lines. Contribute to pinojs/pino-pretty development by creating an account on GitHub.
github.com

I shipped a new release of thread-stream - the utility that pino uses to implement fast, cross thread streaming. This new version fixes a bug when used in conjunction with Yarn PnP.

Release v0.13.1 · pinojs/thread-stream · GitHub
Release v0.13.1 · pinojs/thread-stream · GitHub
A streaming way to send data to a Node.js Worker Thread - Release v0.13.1 · pinojs/thread-stream
github.com
Release v0.13.1 · pinojs/thread-stream · GitHub
Release v0.13.1 · pinojs/thread-stream · GitHub
A streaming way to send data to a Node.js Worker Thread - Release v0.13.1 · pinojs/thread-stream
github.com

We shipped a release of the standard pino serializers to support the new AggregateError that are now part of JavaScript. Check it out!

Release v5.1.0 · pinojs/pino-std-serializers · GitHub
Release v5.1.0 · pinojs/pino-std-serializers · GitHub
🌲 A list of standard object serializers for the Pino logger - Release v5.1.0 · pinojs/pino-std-serializers
github.com
Release v5.1.0 · pinojs/pino-std-serializers · GitHub
Release v5.1.0 · pinojs/pino-std-serializers · GitHub
🌲 A list of standard object serializers for the Pino logger - Release v5.1.0 · pinojs/pino-std-serializers
github.com

We shipped a new fix about the caller recognition in pino that improves the reusability of transport modules, check it out:

Release v7.6.4 · pinojs/pino · GitHub
Release v7.6.4 · pinojs/pino · GitHub
🌲 super fast, all natural json logger. Contribute to pinojs/pino development by creating an account on GitHub.
github.com
Release v7.6.4 · pinojs/pino · GitHub
Release v7.6.4 · pinojs/pino · GitHub
🌲 super fast, all natural json logger. Contribute to pinojs/pino development by creating an account on GitHub.
github.com

We also shipped a new version of pino-http that implement access to custom properties in the response:

Release v6.6.0 · pinojs/pino-http · GitHub
Release v6.6.0 · pinojs/pino-http · GitHub
🌲 high-speed HTTP logger for Node.js. Contribute to pinojs/pino-http development by creating an account on GitHub.
github.com
Release v6.6.0 · pinojs/pino-http · GitHub
Release v6.6.0 · pinojs/pino-http · GitHub
🌲 high-speed HTTP logger for Node.js. Contribute to pinojs/pino-http development by creating an account on GitHub.
github.com

Last but not least, we landed a change adding multi wildcard support to fast-redact, the library that pino uses to perform data redaction (it’s critical for managing private data according to the various laws). Enjoy:

Multi wildcard support finalization by lrecknagel · Pull Request #40 · davidmarkclements/fast-redact · GitHub
Multi wildcard support finalization by lrecknagel · Pull Request #40 · davidmarkclements/fast-redact · GitHub
First - thanks for all the efforts already put in this project and also the PR with I`am picking up! 2nd - I hope I have picked up the prior work correctly, please tell me if I take a wrong path here. (Followed the suggested manual: https://gist.github.com/jsumners/461ef7a64545108635cc437fde112721) I´ve worked on finishing the multi-wildcard feature #36 with the missing test-coverage. hope we can bring this feature to life!
github.com
Multi wildcard support finalization by lrecknagel · Pull Request #40 · davidmarkclements/fast-redact · GitHub
Multi wildcard support finalization by lrecknagel · Pull Request #40 · davidmarkclements/fast-redact · GitHub
First - thanks for all the efforts already put in this project and also the PR with I`am picking up! 2nd - I hope I have picked up the prior work correctly, please tell me if I take a wrong path here. (Followed the suggested manual: https://gist.github.com/jsumners/461ef7a64545108635cc437fde112721) I´ve worked on finishing the multi-wildcard feature #36 with the missing test-coverage. hope we can bring this feature to life!
github.com

News

Read up this twitter thread from my friend Bryan English on tracking asynchronous context through multiple libraries:

Another very interesting twitter thread is from Tobie, take a look at his opinion on Color.js and Faker.js.

What does have the maintainer of CURL to say about OSS sustainability? Daniel maintains a very important piece of the ecosystem.

Enforcing the pyramid of Open Source | daniel.haxx.se
Enforcing the pyramid of Open Source | daniel.haxx.se
The well-known log4j security vulnerability of December 2021 triggered a lot of renewed discussions around software supply chain security, and sometimes it has also been said to be an Open Source related issue.
daniel.haxx.se
Enforcing the pyramid of Open Source | daniel.haxx.se
Enforcing the pyramid of Open Source | daniel.haxx.se
The well-known log4j security vulnerability of December 2021 triggered a lot of renewed discussions around software supply chain security, and sometimes it has also been said to be an Open Source related issue.
daniel.haxx.se

If you have not heard about Remix, it’s a new React metaframework that is taking over all the buzz in the JS world. Here is a long comparison with Next.js. Read up:

Remix vs Next.js
Remix vs Next.js
Easily the biggest question we get asked is something like: How is Remix different from Next.js?
remix.run
Remix vs Next.js
Remix vs Next.js
Easily the biggest question we get asked is something like: How is Remix different from Next.js?
remix.run

If you are a leader in a technology organisation, you should read this must-read article on how to integrate technology and business. This is the most important part of the article. Enjoy

How “Engineering-Driven” Leads to “Engineering-Supremacy”
How “Engineering-Driven” Leads to “Engineering-Supremacy”
Honeycomb has a reputation for being a very engineering-driven company. No surprise there, since it was founded by two engineers and our mission involves building an engineering product for other engineers.
charity.wtf

Want to learn how Amazon sped up the latency of their e-commerce platform, improving sales? Follow this twitter feed:

Don't miss what's next. Subscribe to Adventures in Nodeland:
GitHub X YouTube LinkedIn