Laslo
Laslo
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
I'm using express and mongo on Deno, and i'm also trying to use express-rate-limit, however, i'm getting the following error on rate-limit because the request.ip is undefined:
ValidationError: An undefined 'request.ip' was detected. This might indicate a misconfiguration or the connection being destroyed prematurely. See https://express-rate-limit.github.io/ERR_ERL_UNDEFINED_IP_ADDRESS/ for more information.
at Object.ip (file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:97:13)
at Object.wrappedValidations.<computed> [as ip] (file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:296:22)
at Object.keyGenerator (file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:549:20)
at file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:601:32
at Object.runMicrotasks (ext:core/01_core.js:934:26)
at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:10)
at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
at eventLoopTick (ext:core/01_core.js:189:21)
at async file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:583:5 {
name: "ValidationError",
code: "ERR_ERL_UNDEFINED_IP_ADDRESS",
help: "https://express-rate-limit.github.io/ERR_ERL_UNDEFINED_IP_ADDRESS/"
}
ValidationError: An undefined 'request.ip' was detected. This might indicate a misconfiguration or the connection being destroyed prematurely. See https://express-rate-limit.github.io/ERR_ERL_UNDEFINED_IP_ADDRESS/ for more information.
at Object.ip (file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:97:13)
at Object.wrappedValidations.<computed> [as ip] (file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:296:22)
at Object.keyGenerator (file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:549:20)
at file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:601:32
at Object.runMicrotasks (ext:core/01_core.js:934:26)
at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:10)
at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
at eventLoopTick (ext:core/01_core.js:189:21)
at async file:///node_modules/.deno/express-rate-limit@7.1.5/node_modules/express-rate-limit/dist/index.mjs:583:5 {
name: "ValidationError",
code: "ERR_ERL_UNDEFINED_IP_ADDRESS",
help: "https://express-rate-limit.github.io/ERR_ERL_UNDEFINED_IP_ADDRESS/"
}
I've found this answer on a similar question that suggests adding app.set('trust proxy', 1); i tried it, but the ip continues undefined.
27 replies