Comments (12)
I will create a PR then
from fastify-request-context.
Check out the underlying library that we use, it already uses ALS when supported by used Node version.
from fastify-request-context.
As far as I can see if is part of node 14. So i agree, we can replace this dependency with the built in.
Can you provide a PR?
from fastify-request-context.
This is not an issue, but I struggled to integrate the AsyncLocalStorage
with fastify so I am sharing the solution here.
I noticed it only work with the preHandler
hook.
from fastify-request-context.
This plugin works with any lifecycle phase, and does not use the library that you mentioned.
@Uzlopak what's the minimum Node requirement for fastify 4?
from fastify-request-context.
node 14 is the minimum requirement.
from fastify-request-context.
I think there's a mix up between @kibertoad's asynchronous-local-storage
module which is used here and the archived async-local-storage
module.
The asynchronous-local-storage
module uses the AsyncLocalStorage
from node:async_hooks
when that's enabled, else downgrades to cls-hooked
.
It's probably time to drop cls-hooked
in asynchronous-local-storage
, but that's a separate issue for that repository I think, its only an issue for this project if that would make asynchronous-local-storage
so small that it would make more sense to include it directly within this module.
from fastify-request-context.
Yeah, I was planning to do that for quite a while. PR would be welcome
from fastify-request-context.
Yeah, I was planning to do that for quite a while. PR would be welcome
@kibertoad PR for which of the two?
- Removing
cls-hooked
fromasynchronous-local-storage
- Moving the
node:async_hooks
based part ofasynchronous-local-storage
into this module, removingasynchronous-local-storage
as a separate dependency
from fastify-request-context.
The second one.
from fastify-request-context.
While bumping Fastify major is hard, bumping an individual package is easy. There are good reasons to bump this package major version and drop Node.js v14.
from fastify-request-context.
I'm making a PR
from fastify-request-context.
Related Issues (17)
- In E2E tests, fastify-request-context is not closing properly after calling fastify.close() HOT 8
- Default value persists if used wrongly HOT 3
- Expose API for direct access to the context HOT 5
- Allow set the defaultStoreValues by factory HOT 3
- Please publish version 3.1.1 to npm HOT 4
- lost context when use @fastify/multipart HOT 8
- Enable default context items derived from `request`
- Stricter default context interface? HOT 4
- Customizable AsyncResource.type and create-resource HOT 2
- CI seems to be failing HOT 4
- Update files HOT 1
- FastifyDeprecation: You are decorating Request/Reply with a reference type HOT 3
- Node 16.2.0 with Jest break AsyncLocalStorage HOT 13
- [FSTDEP006] FastifyDeprecation: You are decorating Request/Reply with a reference type. This reference is shared amongst all requests. Use onRequest hook instead. HOT 1
- Plugin not working with fastify 3.x HOT 1
- Using `strict` in a project `tsconfig.json` makes `requestContext.get(string)` possibly `undefined` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify-request-context.