pokelyzer
pokelyzer copied to clipboard
Problem with save data to database - Windows
I don't know what I do wrong
but i read this https://github.com/Brideau/pokelyzer/issues/29 and this https://github.com/Brideau/pokelyzer/issues/67 and try (i think) everything but without success. I always have this error http://imgur.com/a/arICQ
I'm using Windows 8.1. Maybe any advice what to try? Sorry for my very bad English but i have hope you understand me
Looks like the web hook listener and the database are at different versions, since listener is trying to add data for a column that doesn't exist. When did you set everything up, and have you applied the patches that have come out since then?
I set up everything today from zero about 20:00. But earlier (before niantic disable api) i set it on other computer and everything work fine
probably i make some very stupid mistake - like always ;/
Have you added the patch that was put up today? https://github.com/Brideau/pokelyzer/wiki/Patches
I'm experiencing the same with the newest patches and everything:
EDIT: Fixed it by re-running the windowsBatch.bat under admin mode. Very weird as it didn't take the first couple of times :|
Z:\Desktop\PokemonGo-Map-develop\pokelyzer-master>node app.js
Running server on port 9876
Error fetching client from pool { [error: password authentication failed for use
r "pokemon_go_role"]
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '285',
routine: 'auth_failed' }
Idle client error read ECONNRESET Error: read ECONNRESET
at exports._errnoException (util.js:873:11)
at TCP.onread (net.js:557:26)
Yes I added all patches - but for sure i can set databese one more time - but today i don't have much time for this
I tried run windowsBatch.bat as admin - but only one time, maybe i need more attemps
I will try manage with this after work and i will tell you about effect
EDIT: I try run windowsBatch.bat as admin (few times) but without success ;/ - i have the same error. Sorry but i don't have time for trying something else. I will back to fight with this problem about weekend
It's broken again this morning. Exact same issue, no idea how I got it to work last night only to have it break again this morning. Pokemon_go_role just isn't registering a PW.
I tkink that someone else have the same exprience like you https://github.com/Brideau/pokelyzer/issues/72
the odd thing is that it worked when i run it the first time (after configure everything on this computer), but when i stop and want to start it one more time i always have this error.
Error still here; cannot fix :|
I just tried setting pg_hba.conf to: host all all IP/32 trust
Still not working :(
@acmt @QuadTog I just made some changes that allow you to set these parameters in a config file instead of via the command line. Can you try the newest version, and put your settings in config.js and let me know how it goes?
I will try and let you know - but I dont have time for this now - i will check it at weekend
I'm getting a similar error. I tried using the newest version with the config.js file set up but still having issues.
Error running query { [error: column "undefined" does not exist] name: 'error', length: 103,, severity: 'ERROR', code: '42703', detail: undefined, hint: undefined, position: '431', internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column, undefined, dataType: undefined, constraint: undefined, file: 'parse_relation.c', line: '3090', routine: 'errorMissingColumn'}
btw, I just set this up yesterday and it seemed to run fine for a couple of hours. This error popped up after I ran the scanner overnight. Since I set up yesterday and I have the "lured" column in my database I'm assuming my installation is up to date with all of the patches.
Edit: Looked into problem #72 and this is what I get when I uncomment that query_string line
INSERT INTO spotted_pokemon ( encounter_id, last_modified_time, time_until_hidden_ms, hidden_time_unix_s, hidden_time_utc, spawnpoint_id, longitude, latitude, pokemon_id, longitude_jittered, latitude_jittered, pokemon_go_era, lured) VALUES ( '18446744072287771420'::text, undefined::bigint, null::bigint, 1470768054::bigint, '2016-08-09 18:40:54'::timestamp, 'undefined'::text, -114.067758::double precision, 51.045624::double precision, 21::smallint, -114.06758149982942::double precision, 51.04553946576027::double precision, 3::integer, 'Lured'::text ) ON CONFLICT (encounter_id, spawnpoint_id) DO UPDATE SET last_modified_time = EXCLUDED.last_modified_time, time_until_hidden_ms = EXCLUDED.time_until_hidden_ms, hidden_time_unix_s = EXCLUDED.hidden_time_unix_s, hidden_time_utc = EXCLUDED.hidden_time_utc;
Also every once in a while it still says "Pokemon with ID xx found." Does that mean this error only shows up for specific pokemon?
It looks like it's missing the last_modified_time, time_until_hidden_ms and spawn_point_id fields. This was happening before the latest version of the web hook listener was posted yesterday, since it didn't properly handle 'lured' pokemon. Can you check that you have the newest version of app.js and post its contents here?
I just made sure I had the latest version of app.js but still getting the same issue. I think you're right... if I run my scanner in an area that I think has no lures (suburbs) I get no errors, if I run it downtown which I assume has a bunch of lures on the errors show up. So it seems like lured pokemon are causing the issue.
What do you mean by "... and post its contents here?" Do you want me to post the code of the app.js file?
Yep, post the content itself. It just helps me confirm that the version you're running is the same as mine.
Here it is: var express = require('express'); var bodyParser = require('body-parser'); var moment = require('moment')
var gaussian = require('gaussian'); var dist = gaussian(0, 0.3);
var configFile = require('./config'); // Set up Postgres connection var pg = require('pg'); var config = { user: process.env.DB_USER || configFile.DB_USER, database: process.env.DB_NAME || configFile.DB_NAME, password: process.env.DB_PASS || configFile.DB_PASS, port: process.env.DB_PORT || configFile.DB_PORT, max: 20, idleTimeoutMillis: 30000 } var pool = new pg.Pool(config); var encounter_encoded = process.env.ENC_ENC || configFile.ENC_ENC;
var app = express(); app.use(bodyParser.urlencoded({extended : true})); app.use(bodyParser.json());
var server = require('http').Server(app); var port = process.env.WS_PORT || configFile.WS_PORT; var era = process.env.ERA || configFile.ERA;
server.listen(port, function (err) { console.info('Running server on port ' + port); });
app.post('/', function(req, res) { var body = req.body; if (body.type == "pokemon") { var m = body.message; m.pokemon_go_era = era; m.hidden_time_unix_s = m.disappear_time; m.hidden_time_utc = moment .unix(m.hidden_time_unix_s).utc() .format("YYYY-MM-DD HH:mm:ss"); m.latitude_jittered = parseFloat(m.latitude) + dist.ppf(Math.random()) * 0.0005; m.longitude_jittered = parseFloat(m.longitude) + dist.ppf(Math.random()) * 0.0005; if (m.is_lured == true) { m.time_until_hidden_ms = null; m.is_lured = "Lured"; } else { m.is_lured = "Not Lured"; }
if (encounter_encoded == "t") {
buff = new Buffer(m.encounter_id, 'base64');
m.encounter_id = buff.toString();
}
// console.log(m);
pool.connect(function(err, client, done) {
if(err) {
return console.log('Error fetching client from pool', err);
}
query_string = "INSERT INTO spotted_pokemon ( \
encounter_id, \
last_modified_time, \
time_until_hidden_ms, \
hidden_time_unix_s, \
hidden_time_utc, \
spawnpoint_id, \
longitude, \
latitude, \
pokemon_id, \
longitude_jittered, \
latitude_jittered, \
pokemon_go_era, \
lured) \
VALUES ( \
'" + m.encounter_id + "'::text, \
" + m.last_modified_time + "::bigint, \
" + m.time_until_hidden_ms + "::bigint, \
" + m.hidden_time_unix_s + "::bigint, \
'" + m.hidden_time_utc + "'::timestamp, \
'" + m.spawnpoint_id + "'::text, \
" + m.longitude + "::double precision, \
" + m.latitude + "::double precision, \
" + m.pokemon_id + "::smallint, \
" + m.longitude_jittered + "::double precision, \
" + m.latitude_jittered + "::double precision, \
" + m.pokemon_go_era + "::integer, \
'" + m.is_lured + "'::text \
) \
ON CONFLICT (encounter_id, spawnpoint_id) \
DO UPDATE \
SET last_modified_time = EXCLUDED.last_modified_time, \
time_until_hidden_ms = EXCLUDED.time_until_hidden_ms, \
hidden_time_unix_s = EXCLUDED.hidden_time_unix_s, \
hidden_time_utc = EXCLUDED.hidden_time_utc;";
console.log(query_string);
console.log("Pokemon with ID " + m.pokemon_id + " found.")
client.query(query_string,
function(err, result) {
// console.log(result);
done();
if(err) {
return console.log("Error running query", err);
}
});
});
}
res.sendStatus(200);
});
pool.on('error', function(err, client) { console.log('Idle client error', err.message, err.stack); });
OK, that looks good to me. The next thing that would help is if you uncommented console.log(m);
and posted the output whenever there's an error. This prints the message body being received, and should help me figure out why there's an exception happening on the lured pokemon.
So this is what I get (it continues on for a bunch of pokemon but this is the basic pattern):
Running server on port 9876 { disappear_time: 1470775512, pokemon_id: 41, longitude: -114.063451, latitude: 51.050215, is_lured: 'Lured', encounter_id: '18446744071877535967', pokemon_go_era: '3', hidden_time_unix_s: 1470775512, hidden_time_utc: '2016-08-09 20:45:12', latitude_jittered: 51.050159808545686, longitude_jittered: -114.06363057903249, time_until_hidden_ms: null } { disappear_time: 1470775584, pokemon_id: 13, longitude: -114.069763, latitude: 51.048919, is_lured: 'Lured', encounter_id: '1721851421', pokemon_go_era: '3', hidden_time_unix_s: 1470775584, hidden_time_utc: '2016-08-09 20:46:24', latitude_jittered: 51.04909196721303, longitude_jittered: -114.07024165096342, time_until_hidden_ms: null } Pokemon with ID 41 found. { disappear_time: 1470775549, pokemon_id: 92, longitude: -114.066953, latitude: 51.050671, is_lured: 'Lured', encounter_id: '18446744072970775245', pokemon_go_era: '3', hidden_time_unix_s: 1470775549, hidden_time_utc: '2016-08-09 20:45:49', latitude_jittered: 51.0508016531458, longitude_jittered: -114.06693278702875, time_until_hidden_ms: null } Pokemon with ID 13 found. Error running query { [error: column "undefined" does not exist] name: 'error', length: 103, severity: 'ERROR', code: '42703', detail: undefined, hint: undefined, position: '431', internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'parse_relation.c', line: '3090', routine: 'errorMissingColumn' } Pokemon with ID 92 found. Error running query { [error: column "undefined" does not exist] name: 'error', length: 103, severity: 'ERROR', code: '42703', detail: undefined, hint: undefined, position: '421', internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'parse_relation.c', line: '3090', routine: 'errorMissingColumn' } { disappear_time: 1470775498, pokemon_id: 19, longitude: -114.068714, latitude: 51.044616, is_lured: 'Lured', encounter_id: '1802186915', pokemon_go_era: '3', hidden_time_unix_s: 1470775498, hidden_time_utc: '2016-08-09 20:44:58', latitude_jittered: 51.04450039947027, longitude_jittered: -114.06874653119144, time_until_hidden_ms: null } Pokemon with ID 19 found.
OK I got the error again and commented out the log dump of the sql query. Here's what it's trying to run:
INSERT INTO spotted_pokemon ( encounter_id, last_modified_time, time_until_hidde n_ms, hidden_time_unix_s, hidden_time_utc, spawnpoint_id, longitude, latitude, pokemon_id, longitude_jittered, latitude_jittered, pokemon_go_era, lured) VALUES ( '1090825281'::text, undefined::bigint, null::bigint, 1470779927::bigint, '2016-08-09 21:58:47'::timestamp, 'un defined'::text, -93.535812::double precision, 47.210766::double precision, 79::s mallint, -93.53598868576812::double precision, 47.21071233538372::double precision, 2::integer, 'Lured'::text ) ON CONFLICT (encounter_id, spawnpoint_id) DO UPDATE SET last_modified_time = EXCLUDED.last_modified_time, time_until_hidden_ms = EXCLU DED.time_until_hidden_ms, hidden_time_unix_s = EXCLUDED.hidden_time_unix_s, hidden_time_ut c = EXCLUDED.hidden_time_utc;
I added this above the query and the error went away but I don't know if inserting NULL into the last_modified_time will have an effect on the tools that read/interpret the data.
if (typeof m.last_modified_time == 'undefined') {
m.last_modified_time = "NULL";
}
I figure worst case I let it put NULL in and if it's a problem I can delete those entries later. Not knowing what it was used for I considered 0 as an option but settled on NULL.
I've been trying to reproduce this but I cannot seem to. Out of curiosity, what version of Node are you both running @lennon681 and @Pistachio9? And what repo/branch is your version of PokemonGo-Map pulled from?
@lennon681 That'll probably patch things up, but it doesn't get to the root of the problem. That field should exist whether it's lured or not.
Node version 4.4.7 and the develop branch of PokemonGo-Map
Same Problem, Error fetching client from pool { [error: password authentication failed for use r "pokemon_go_role"]
EDIT: Solved by editing the role and setting password to something other: 123, now works
For me it works whenever I run the set DB_PASS=xxxx
command before running node app.js
. Anyway it will not work if I put the command in my batch file start cmd /k "set DB_PASS=xxxx & node app.js"
and just run the batch file .. strange thing. Also the solution of the post before mine with changing the password does not work here.