Open toderitagcristian opened 4 years ago
More info from puppetter with pm2 on nodejs:
2020-01-09T21:34:08: pageerror: [Error: TypeError: a.substr is not a function 2020-01-09T21:34:08: at Function.H.substr (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:12:173) 2020-01-09T21:34:08: at Function.I.pb (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:13:265) 2020-01-09T21:34:08: at J.P (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:112:457) 2020-01-09T21:34:08: at Function.g.ie (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:41:274) 2020-01-09T21:34:08: at Ga.$e (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:47:213) 2020-01-09T21:34:08: at Ga.Bd (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:47:134) 2020-01-09T21:34:08: at Ga.cc (https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:45:286) 2020-01-09T21:34:08: at https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js:55:134]
@basro Hi ! The error further details : https://www.haxball.com/4WqKEIlM/__cache_static__/g/headless-min.js headless-min.js:12:173
Error seems to occur on firefox private window only.
EDIT : As a side note. I observed that I cannot join remote headless rooms with firefox new private window and normal window. I can join remote rooms without headless with both private and normal window. Also I can join localhost room with headless with both private and normal window. I am referring to simultaneously
Can you please tell why do I get this error ? I am not using substr in my script so it must be from haxball scripts.
Guess it tries to read something and it is not there. Some help on debugging would be great :)
Second question ... I am trying to use fetch() with room.onPlayerJoin What is your opinion on using async / await with room events ?:
room.onPlayerJoin = async function(player) { await room.sendAnnouncement(credits, player.id, 0xFCD116, "bold", 0); let jucator = await fetch(
http://localhost:3000/users/${player.auth}
) .then((response) => { return response.json(); }) .then((jucatorJson) => { return jucatorJson;}) .catch((error) => { console.error('Error:', error); });; // rest of the script .... }