sync command - SyntaxError: Unexpected token o in JSON at position 1
lovasoa opened this issue · 8 comments
Hello,
I recently got the following error on CI, so I thought I would report it :
> openode sync && openode restart
[Sat Mar 21 2020 19:04:09 GMT+0000 (Coordinated Universal Time)] - [+] Authentication valid.
-
Processing for canada
SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at execSyncFiles (/home/travis/build/lovasoa/whitebophir/node_modules/openode/modules/deploy.js:276:24)
at process._tickCallback (internal/process/next_tick.js:68:7)
[ { SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at execSyncFiles (/home/travis/build/lovasoa/whitebophir/node_modules/openode/modules/deploy.js:276:24)
at process._tickCallback (internal/process/next_tick.js:68:7) location: 'canada' } ]
[Sat Mar 21 2020 19:04:42 GMT+0000 (Coordinated Universal Time)] - [+] Authentication valid.
-
Processing for canada
[ { result: 'success', deploymentId: 1816, location: 'canada' } ]
It happened only one, and relaunching the command did not reproduce the error.
Looks like there was a communication issue and your openode client got a maliformed json back. Does the error occur more often or only once?
I have currently only seen it once. And yes, it looks like an error in the backend. But anyway, maybe the cli tool could handle this error gracefully ?
Hi,
Thanks for reporting. Note that this is a deployment done using the legacy method, we upgraded recently, please see https://www.openode.io/docs/installation/upgrade.md
Will see if it happens also using the new system.
I am now getting this error systematically
$ npx openode deploy
[Fri Apr 03 2020 20:25:25 GMT+0200 (Central European Summer Time)] - [+] Authentication valid.
⠸ SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at execSyncFiles (/Users/olojkine/Developpement/whitebophir/node_modules/openode/modules/deploy.js:276:24)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.deploy (/Users/olojkine/Developpement/whitebophir/node_modules/openode/modules/deploy.js:360:7)
at async progress (/Users/olojkine/Developpement/whitebophir/node_modules/openode/index.js:758:16)
at async runCommand (/Users/olojkine/Developpement/whitebophir/node_modules/openode/index.js:19:18)
at async Command.<anonymous> (/Users/olojkine/Developpement/whitebophir/node_modules/openode/index.js:126:7)
SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at execSyncFiles (/Users/olojkine/Developpement/whitebophir/node_modules/openode/modules/deploy.js:276:24)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.deploy (/Users/olojkine/Developpement/whitebophir/node_modules/openode/modules/deploy.js:360:7)
at async progress (/Users/olojkine/Developpement/whitebophir/node_modules/openode/index.js:758:16)
at async runCommand (/Users/olojkine/Developpement/whitebophir/node_modules/openode/index.js:19:18)
at async Command.<anonymous> (/Users/olojkine/Developpement/whitebophir/node_modules/openode/index.js:126:7)
Thanks, will investigate this asap.
Improvement done (graceful exit with more log details) in the new CLI version (2.0.16), npm i -g openode to upgrade. If the issue still occur, it should output more details.
Keeping it open to monitor
I updated the cli tool and redeployed, but this time the deploy worked. Did you investigate the issue on the server side ?
No, if it still occur we will have more details and look at it again. It seemed to be happening during peak hours, and a "3 seconds" timeout was present and has been removed in the new version.