Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(node:71664) [FSTDEP005] FastifyDeprecation "request.connection" #86

Open
marlon-chagas opened this issue May 2, 2023 · 3 comments
Open

Comments

@marlon-chagas
Copy link

Im using request-ip in my fastify application and after I updated to Fastify@4 Im getting following warning:

(node:71664) [FSTDEP005] FastifyDeprecation: You are accessing the deprecated "request.connection" property. 
Use "request.socket" instead.
    at Object.emit (xxxx/process-warning/index.js:52:13)
    at Request.get (xxxx/fastify/lib/request.js:211:17)
    at Object.getClientIp (xxxx/request-ip/lib/index.js:88:21)
    at resolveIp (xxxx/dist/middlewares/my-file.js:7:89)
    at Object.fastifyReqLogger [as req] (xxxxx/dist/main.js:62:69)
    at Pino.asJson (xxxx/pino/lib/tools.js:132:33)
    at Pino.write (xxxx/pino/lib/proto.js:205:28)
    at Pino.LOG [as info] (xxxx/pino/lib/tools.js:62:21)
    at Object.routeHandler [as handler] (xxxx/fastify/lib/route.js:470:19)
    at Router.callHandler (xxxx/find-my-way/index.js:398:14)"

It is a simple fix by modifying the following code snippet:
image

as the latest version of fastify suggests.

Can I open PR with that fix?

@Ismaaa
Copy link

Ismaaa commented Jun 13, 2023

Your contribution sounds valuable @marlon-chagas ! Please do open a PR with your fix.

@System233
Copy link

@pbojinov

@System233
Copy link

Repository not maintained.
For fastify OR express you probably don't need request-ip, they have built-in support, check out fastify-trustproxy or expess-behind-proxies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants