Ethaan / nodejs-tibia-api

:scroll: Get Tibia.com character information quick and easy
MIT License
9 stars 2 forks source link

Error info #11

Closed eduardokum closed 4 years ago

eduardokum commented 5 years ago

I run the command !addFriend and i get this error constantly and the character is not added on friends channel

TypeError: Cannot read property 'info' of undefined
    at info (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:158:41)
    at Array.forEach (<anonymous>)
    at forEach (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:158:30)
    at tryCatch (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:36:103)
    at _next (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:38:194)
    at <anonymous>

debugging i see this problem

{ CloudflareError: 1020, Access Denied (Custom Firewall Rules)
    at validateResponse (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/cloudscraper/index.js:240:11)
    at onCloudflareResponse (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/cloudscraper/index.js:195:5)
    at onRequestResponse (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/cloudscraper/index.js:178:5)
    at Request.<anonymous> (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/cloudscraper/index.js:137:7)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Gunzip.<anonymous> (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at Gunzip.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'CloudflareError',
  message: '1020, Access Denied (Custom Firewall Rules)' }

somehow cloudflare is blocking my access to the tibia site, is there anything i can do?

eduardokum commented 5 years ago

debugging cloudscraper i get this

REQUEST { requester: 
   { [Function: request]
     get: [Function],
     head: [Function],
     options: [Function],
     post: [Function],
     put: [Function],
     patch: [Function],
     del: [Function],
     delete: [Function],
     jar: [Function],
     cookie: [Function],
     defaults: [Function],
     forever: [Function],
     Request: 
      { [Function: Request]
        super_: [Object],
        debug: true,
        defaultProxyHeaderWhiteList: [Array],
        defaultProxyHeaderExclusiveList: [Array] },
     initParams: [Function: initParams],
     debug: [Getter/Setter],
     bindCLS: [Function: RP$bindCLS] },
  jar: 
   RequestJar {
     _jar: CookieJar { enableLooseMode: true, store: { idx: {} } } },
  headers: 
   { Host: Symbol(host),
     Connection: 'keep-alive',
     'Upgrade-Insecure-Requests': '1',
     'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36',
     Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
     'Accept-Language': 'en-US,en;q=0.8',
     'Accept-Encoding': 'gzip, deflate, ' },
  cloudflareMaxTimeout: 30000,
  followAllRedirects: true,
  challengesToSolve: 3,
  decodeEmails: false,
  gzip: true,
  agentOptions: 
   { ciphers: 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA:!ECDHE+SHA:!AES128-SHA' },
  uri: 'https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor',
  header: 
   { 'Cache-Control': 'max-age=0, no-cache, must-revalidate, proxy-revalidate' },
  method: 'GET',
  realEncoding: 'utf8',
  encoding: null,
  callback: [Function: RP$callback],
  transform: undefined,
  simple: true,
  resolveWithFullResponse: false,
  transform2xxOnly: false }
REQUEST make request https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor
REQUEST onRequestResponse https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor 403 { date: 'Wed, 30 Oct 2019 04:07:40 GMT',
  'content-type': 'text/html; charset=UTF-8',
  'transfer-encoding': 'chunked',
  connection: 'keep-alive',
  'set-cookie': 
   [ '__cfduid=dadac3b73e8ba480c31fb3292117f8f161572408460; expires=Thu, 29-Oct-20 04:07:40 GMT; path=/; domain=.tibia.com; HttpOnly; Secure' ],
  'cache-control': 'max-age=15',
  expires: 'Wed, 30 Oct 2019 04:07:55 GMT',
  'x-frame-options': 'SAMEORIGIN',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  vary: 'Accept-Encoding',
  server: 'cloudflare',
  'cf-ray': '52da860be865c5c4-EWR',
  'content-encoding': 'gzip' }
REQUEST reading response's body
REQUEST finish init function https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor
REQUEST response end https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor 403 { date: 'Wed, 30 Oct 2019 04:07:40 GMT',
  'content-type': 'text/html; charset=UTF-8',
  'transfer-encoding': 'chunked',
  connection: 'keep-alive',
  'set-cookie': 
   [ '__cfduid=dadac3b73e8ba480c31fb3292117f8f161572408460; expires=Thu, 29-Oct-20 04:07:40 GMT; path=/; domain=.tibia.com; HttpOnly; Secure' ],
  'cache-control': 'max-age=15',
  expires: 'Wed, 30 Oct 2019 04:07:55 GMT',
  'x-frame-options': 'SAMEORIGIN',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  vary: 'Accept-Encoding',
  server: 'cloudflare',
  'cf-ray': '52da860be865c5c4-EWR',
  'content-encoding': 'gzip' }
REQUEST end event https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor
REQUEST has body https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor 3061
REQUEST emitting complete https://www.tibia.com/community/?subtopic=characters&name=Falaron%20Ghanor
TypeError: Cannot read property 'info' of undefined
    at info (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:158:41)
    at Array.forEach (<anonymous>)
    at forEach (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:158:30)
    at tryCatch (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:36:103)
    at _next (/opt/teamspeak3-server/bot/tibia-ts3-teamspeakbot/src/api/crone/lists.js:38:194)
    at <anonymous>