Laslo
Laslo
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
👎
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
:samurai_deno:
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
?
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
No description
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
hello, do you have any idea if it still will take long to your fixes get in deploy?
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
i thought was the same, where i can follow about the deploy
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
No description
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
i saw that Deno updated to 1.4.0 and the changelog mention your commit but I continue getting undefined when reading the request ip
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
No description
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
Yes, but the ip will be on request.ip or will need to look for it somewhere else?
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
ty, how do i know when this version is released? also, will be possible to read the ip as req.ip?
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
sad, this already had been reported at 2022 and still didnt fixed
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
The ip is undefined and its missing all headers, i'm not sure if this is a bug or if i'm missing something, any help is appreciated. obs: i had to split the question on multiple comments because discord was limiting number of characters
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
ip: undefined
conn: FakeSocket {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
remoteAddress: undefined,
remotePort: undefined,
encrypted: undefined,
writable: true,
readable: true,
[Symbol(kCapture)]: false
}
conn.remoteAddress: undefined
client: undefined
headers:
{
"accept-encoding": "gzip, deflate",
"accept-language": "en-US,en,*",
"content-length": "14",
"content-type": "application/json",
host: "....deno.dev",
"user-agent": "Mozilla/5.0"
}
rawHeaders: undefined
client: undefined
X-Forwarded-For: undefined
req: <ref *1> IncomingMessageForServer {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: null,
closed: true,
closeEmitted: false,
defaultEncoding: "utf8",
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_read: [AsyncFunction: read],
_destroy: [Function: destroy],
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
url: "/api/users",
method: "POST",
next: [Function: next],
baseUrl: "",
originalUrl: "/api/users",
_parsedUrl: Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null
ip: undefined
conn: FakeSocket {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
remoteAddress: undefined,
remotePort: undefined,
encrypted: undefined,
writable: true,
readable: true,
[Symbol(kCapture)]: false
}
conn.remoteAddress: undefined
client: undefined
headers:
{
"accept-encoding": "gzip, deflate",
"accept-language": "en-US,en,*",
"content-length": "14",
"content-type": "application/json",
host: "....deno.dev",
"user-agent": "Mozilla/5.0"
}
rawHeaders: undefined
client: undefined
X-Forwarded-For: undefined
req: <ref *1> IncomingMessageForServer {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: null,
closed: true,
closeEmitted: false,
defaultEncoding: "utf8",
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_read: [AsyncFunction: read],
_destroy: [Function: destroy],
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
url: "/api/users",
method: "POST",
next: [Function: next],
baseUrl: "",
originalUrl: "/api/users",
_parsedUrl: Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null
27 replies
DDeno
Created by Laslo on 1/16/2024 in #help
Undefined IP on requests
How to reproduce:
"use strict"

import express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import rateLimit from 'express-rate-limit';

const app = express();

mongoose.connect("...");
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() { console.log('Connected to MongoDB'); });

app.use(bodyParser.json());
app.set('trust proxy', 1);

const limiter = rateLimit({ windowMs: 1 * 60 * 1000, max: 3, });
app.post('/api/users', limiter, async (req, res) =>
{
console.log('ip:', req.ip);
console.log('conn:', req.connection)
console.log('conn.remoteAddress:', req.connection.remoteAddress)
console.log('client:', req.client);
console.log('headers:', req.headers);
console.log('rawHeaders:', req.rawHeaders);
console.log('X-Forwarded-For:', req.headers['x-forwarded-for']);
console.dir('req:', req);
try {
const variable = await db.collection("users").findOne({ [req.body.user]: { $exists: true } })
if (!variable) return res.status(404).send('Not found');
res.send(variable);
}
catch (error) { res.status(500).send('Internal Server Error'); }
});

app.listen(5000, () => { console.log(`running`); });
"use strict"

import express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import rateLimit from 'express-rate-limit';

const app = express();

mongoose.connect("...");
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() { console.log('Connected to MongoDB'); });

app.use(bodyParser.json());
app.set('trust proxy', 1);

const limiter = rateLimit({ windowMs: 1 * 60 * 1000, max: 3, });
app.post('/api/users', limiter, async (req, res) =>
{
console.log('ip:', req.ip);
console.log('conn:', req.connection)
console.log('conn.remoteAddress:', req.connection.remoteAddress)
console.log('client:', req.client);
console.log('headers:', req.headers);
console.log('rawHeaders:', req.rawHeaders);
console.log('X-Forwarded-For:', req.headers['x-forwarded-for']);
console.dir('req:', req);
try {
const variable = await db.collection("users").findOne({ [req.body.user]: { $exists: true } })
if (!variable) return res.status(404).send('Not found');
res.send(variable);
}
catch (error) { res.status(500).send('Internal Server Error'); }
});

app.listen(5000, () => { console.log(`running`); });
Testing locally i'm able to see my ip on all these variables, while on Deno this is what being printed:
27 replies