You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, this throws the following error in strict mode.
ReferenceError: [envalid] Env var not found: getter
at Object.get ([...]\node_modules\envalid\dist\envalid.cjs.development.js:351:15)
at decorate ([...]\node_modules\fastify\lib\decorate.js:30:24)
at Object.decorateFastify [as decorate] ([...]\node_modules\fastify\lib\decorate.js:49:3)
at fastifyEnv (file:///E:/Projects/shrujal/node-typescript-fastify/src/plugins/envalid.ts:13:11)
at Plugin.exec ([...]\node_modules\avvio\plugin.js:131:17)
at Boot.loadPlugin ([...]\node_modules\avvio\plugin.js:266:10)
at [...]\node_modules\avvio\plugin.js:256:18
and
ReferenceError: [envalid] Env var not found: setter
at Object.get ([...]\node_modules\envalid\dist\envalid.cjs.development.js:351:15)
at decorate ([...]\node_modules\fastify\lib\decorate.js:30:59)
at Object.decorateFastify [as decorate] ([...]\node_modules\fastify\lib\decorate.js:49:3)
at fastifyEnv (file:///E:/Projects/shrujal/node-typescript-fastify/src/plugins/envalid.ts:13:11)
at Plugin.exec ([...]\node_modules\avvio\plugin.js:131:17)
at Boot.loadPlugin ([...]\node_modules\avvio\plugin.js:266:10)
at [...]\node_modules\avvio\plugin.js:256:18
This behavior makes sense because of how envalid's strictProxyMiddleware() works. You can work around this by providing your own applyMiddleware() option that doesn't use the proxy middleware.
Alternately, you could insert your own forked version of the proxy middleware (allowing use of getter and setter) into the returned value of applyMiddleware()` if you want the rest of the proxy behavior. Hope that helps!
I am trying to decorate
env
variable withcleanEnv
output in Fastify plugin.Currently, this throws the following error in strict mode.
and
This is happening due to Fastify decorate try to check
getter
andsetter
property on the object.https://github.com/fastify/fastify/blob/cc5440ba24de119516597356249aa625f58312bc/lib/decorate.js#L28-L36
Ref: #74, #76, #103, #104
The text was updated successfully, but these errors were encountered: