ThauEx / ffrk-proxy

Proxy for Final Fantasy Record Keeper written in node.js
GNU Lesser General Public License v3.0
39 stars 21 forks source link

SyntaxError: Unexpected 'a' at line 1 column 2 of the JSON5 data. #119

Closed jdel closed 6 years ago

jdel commented 6 years ago

I've been facing an issue with master.

Right when I start I get an error message but the proxy starts. It looks like it's trying to parse JSON instead of YML.

However, the first connection triggers the second stack trace in the below log.

2018-03-23T15:42:39.313436407Z
2018-03-23T15:42:39.313548851Z > ffrk-proxy@0.11.0 start /ffrk
2018-03-23T15:42:39.313571448Z > node bin/app.js "--config" "default-whitelist" "--port" "5050" "--cert-port" "5051"
2018-03-23T15:42:39.313594756Z
2018-03-23T15:42:40.082915965Z Using custom config /ffrk/config/default-whitelist.yml
2018-03-23T15:42:40.100884253Z { SyntaxError: Unexpected 'a' at line 1 column 2 of the JSON5 data. Still to read: "application:\n  proxy"
2018-03-23T15:42:40.101037610Z     at error (/ffrk/node_modules/json5/lib/json5.js:56:25)
2018-03-23T15:42:40.101060558Z     at word (/ffrk/node_modules/json5/lib/json5.js:393:13)
2018-03-23T15:42:40.101080598Z     at value (/ffrk/node_modules/json5/lib/json5.js:493:56)
2018-03-23T15:42:40.101135767Z     at Object.parse (/ffrk/node_modules/json5/lib/json5.js:508:18)
2018-03-23T15:42:40.101156871Z     at loadJSON (/ffrk/node_modules/convict/lib/convict.js:441:16)
2018-03-23T15:42:40.101176421Z     at /ffrk/node_modules/convict/lib/convict.js:583:17
2018-03-23T15:42:40.101228793Z     at Array.forEach (<anonymous>)
2018-03-23T15:42:40.101250016Z     at Object.loadFile (/ffrk/node_modules/convict/lib/convict.js:582:13)
2018-03-23T15:42:40.101269826Z     at Object.<anonymous> (/ffrk/lib/config.js:314:12)
2018-03-23T15:42:40.101323662Z     at Module._compile (module.js:649:30)
2018-03-23T15:42:40.101344505Z   message: 'Unexpected \'a\' at line 1 column 2 of the JSON5 data. Still to read: "application:\\n  proxy"',
2018-03-23T15:42:40.101365106Z   at: 1,
2018-03-23T15:42:40.101418701Z   lineNumber: 1,
2018-03-23T15:42:40.101439273Z   columnNumber: 2 }
2018-03-23T15:42:41.006982019Z ffrk-proxy 0.11.0 started
2018-03-23T15:42:41.007504086Z listening on: 172.18.0.13:5050
2018-03-23T15:42:41.015425886Z rootCA webserver started
2018-03-23T15:42:41.015640738Z listening on: 172.18.0.13:5051
2018-03-23T15:42:41.015723497Z Open http://172.18.0.13:5051 on your phones browser to install the root certificate.
2018-03-23T15:42:51.529200352Z Proxying: POST http://ffrk.denagames.com/dff/notification/get_data
2018-03-23T15:42:51.932425007Z /ffrk/node_modules/convict/lib/convict.js:455
2018-03-23T15:42:51.932591176Z         throw new Error("cannot find configuration param '" + path + "'");
2018-03-23T15:42:51.932617091Z         ^
2018-03-23T15:42:51.932639036Z
2018-03-23T15:42:51.932697875Z Error: cannot find configuration param 'application.proxy.domains'
2018-03-23T15:42:51.932720422Z     at walk (/ffrk/node_modules/convict/lib/convict.js:455:15)
2018-03-23T15:42:51.932777154Z     at Object.get (/ffrk/node_modules/convict/lib/convict.js:514:15)
2018-03-23T15:42:51.932799962Z     at Request.<anonymous> (/ffrk/lib/ffrk-proxy.js:63:28)
2018-03-23T15:42:51.932886109Z     at Request.emit (events.js:180:13)
2018-03-23T15:42:51.932908927Z     at Request.onRequestResponse (/ffrk/node_modules/request/request.js:1068:10)
2018-03-23T15:42:51.932930341Z     at ClientRequest.emit (events.js:180:13)
2018-03-23T15:42:51.932986814Z     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:539:21)
2018-03-23T15:42:51.933009801Z     at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
2018-03-23T15:42:51.933031426Z     at Socket.socketOnData (_http_client.js:444:20)
2018-03-23T15:42:51.933087417Z     at Socket.emit (events.js:180:13)
2018-03-23T15:42:51.933109653Z     at addChunk (_stream_readable.js:269:12)
2018-03-23T15:42:51.933130947Z     at readableAddChunk (_stream_readable.js:256:11)
2018-03-23T15:42:51.933186337Z     at Socket.Readable.push (_stream_readable.js:213:10)
2018-03-23T15:42:51.933208894Z     at TCP.onread (net.js:581:20)
2018-03-23T15:42:52.025948545Z npm ERR! code ELIFECYCLE
2018-03-23T15:42:52.039573208Z npm ERR! errno 1
2018-03-23T15:42:52.039735898Z npm ERR! ffrk-proxy@0.11.0 start: `node bin/app.js "--config" "default-whitelist" "--port" "5050" "--cert-port" "5051"`
2018-03-23T15:42:52.049279108Z npm ERR! Exit status 1
2018-03-23T15:42:52.050009561Z npm ERR!
2018-03-23T15:42:52.050055426Z npm ERR! Failed at the ffrk-proxy@0.11.0 start script.
2018-03-23T15:42:52.050114967Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-03-23T15:42:52.084992041Z
2018-03-23T15:42:52.094252817Z npm ERR! A complete log of this run can be found in:
2018-03-23T15:42:52.094551822Z npm ERR!     /root/.npm/_logs/2018-03-23T15_42_52_034Z-debug.log

My config:

application:
  proxy:
    whitelist: true
  dump:
    get_battle_init_data: false
buddy:
  attack:
    counterability: false
  status: [
        'HASTE',
        'PROTECT',
        'SHELL',
        'REGEN_STRONG',
        'RUNIC',
        'MIGHTY_GUARD_1',
        'GUTS_1',
        'STATUS_AILMENTS_BARRIER'
      ]

Using release 0.11.0 with the same config works perfectly.

ThauEx commented 6 years ago

The master branch has updated libs and a few config options are not working anymore. In my 0.12-pre branch, it's already fixed.

rpgman1 commented 6 years ago

I was wondering why I couldn't use Buster Sword mode anymore when I updated to the latest alpha version. Also fighting 3 rounds instead of 1 round that 0.11.0 have.

ThauEx commented 6 years ago

@rpgman1 this is the wrong issue for that. Please read the issue where I posted the alpha build, there I stated whats currently working and what not.