Skip to content

Nest + Fastify + AsyncLocalStorage middlewares #8843

Closed
@ghost

Description

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The middlewares are not working if fastify (adapter) is installed. When it is removed the middleware starts to work (express adapter), for both GET and POST requests.

Minimum reproduction code

https://github.com/B4nan/nest-fastify-als

Steps to reproduce

yarn
yarn start
curl localhost:3000
curl -X POST localhost:3000

Expected behavior

To return stored value not undefined.

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

8.2.4

Packages versions

platform-express version : 8.2.4
platform-fastify version : 8.2.4
schematics version : 8.0.5
testing version : 8.2.4
common version : 8.2.4
core version : 8.2.4
cli version : 8.1.6

Node.js version

14/16/17

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue has not been looked into

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions