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

error: 'Error occured while trying to process the information' #1

Open
LukeXF opened this issue Dec 4, 2018 · 11 comments
Open

error: 'Error occured while trying to process the information' #1

LukeXF opened this issue Dec 4, 2018 · 11 comments

Comments

@LukeXF
Copy link
Contributor

LukeXF commented Dec 4, 2018

error: 'Error occured while trying to process the information' - how can I debug this?

@CITGuru
Copy link
Owner

CITGuru commented Dec 5, 2018

What kind of error occured?

@CITGuru
Copy link
Owner

CITGuru commented Dec 5, 2018

Fixed

@CITGuru CITGuru closed this as completed Dec 5, 2018
@fcolella
Copy link

Hi guys! I'm getting that error as well, how did you fix it?
Thanks!

just doing this (relevant stuff):

const expressip = require('express-ip');
app.use(expressip().getIpInfoMiddleware); // GEO

app.get('/geo-test', function (req, res) {
res.send(req.ipInfo);
});

@fcolella
Copy link

Nevermind, I have the latest version (1.0.3) but it doesn't have this code:

if ((ip === '127.0.0.1' || ip === '::1')) { return {error:"This won't work on localhost"} }

it has this:

if ((ip === '127.0.0.1')) { return {error:"This won't work on localhost"} }

And my localhost was returning ::1
Also not working when IP data comes with multiple IPs like so "200.x.x.x, 10.x.x.x, 10.x.x.x"
Maybe reverse proxy issue?
Thanks!

@CITGuru
Copy link
Owner

CITGuru commented Jan 10, 2019

Hmmnn. I will add support for that. Thanks raising this up

@CITGuru CITGuru reopened this Jan 10, 2019
@muhaimincs
Copy link

is it solve? I'm also facing the same thing

Nevermind, I have the latest version (1.0.3) but it doesn't have this code:

if ((ip === '127.0.0.1' || ip === '::1')) { return {error:"This won't work on localhost"} }

it has this:

if ((ip === '127.0.0.1')) { return {error:"This won't work on localhost"} }

And my localhost was returning ::1
Also not working when IP data comes with multiple IPs like so "200.x.x.x, 10.x.x.x, 10.x.x.x"
Maybe reverse proxy issue?
Thanks!

@mikestecker
Copy link

I'm having this issue also. I've tried testing using ngrok and console.log my info, but only receive { error: 'Error occured while trying to process the information' }

my code is simply as follows:

server.express.use(expressip().getIpInfoMiddleware);
server.express.use((req, res, next) => {
  const userIp = req.ipInfo;
  if (userIp) {
    console.log(userIp);
    req.userIp = userIp;
  }
  next();
});

@CITGuru
Copy link
Owner

CITGuru commented Aug 27, 2019

@mikestecker I think there's an issue with the ngrok header response. I came across that back ago.

@tamirDavidoff
Copy link

tamirDavidoff commented Apr 12, 2020

Hello everyone, I have a similar issue.
This is the code -
app.get("/ipInfo", function(req,res){
var myEnv = req.connection.remoteAddress;
if (myEnv == "::ffff:127.0.0.1") {
res.send("does this work? " + req.ipInfo);
} else {
res.send(req.ipInfo);
}

});

It works on local and says - This cannot work on a localhost.
It works on NGROK and returns the ipInfo object with all the information

However, on a live server (heroku) It says {"error":"Error occured while trying to process the information"}

please assist me,

Thanks!

@2M4U
Copy link

2M4U commented Oct 9, 2020

express-ip doesn't seem to like x-forwarded-ip headers:

Reproducing the steps:
Using Nginx + NodeJS + Cloudflare.

Example:

{
  ip: '1.3.3.7,1.1.1.1',
  error: 'Error occured while trying to process the information'
}

@seba-wetzel
Copy link

Here is a solution for the issue when we have a proxy

  const getIpInfoMiddleware = function(req, res, next) {
    const xForwardedFor = (req.headers["x-forwarded-for"] || "").
        replace(/:\d+$/, "");
    let ip = xForwardedFor || req.connection.remoteAddress;
    ip = ip.split(",")[0];  //this line select the first ip (if severals)
    req.ipInfo = {ip, ...getIpInfo(ip)};
    next();
  };

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

8 participants