Error when running template after moving codebase to new server
-
Hi i am receiving the following error when I run a report on my server
TypeError: input.on is not a function at new Interface (readline.js:206:11) at Object.createInterface (readline.js:74:10) at Promise (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:327:25) at new Promise (<anonymous>) at waitForWSEndpoint (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:326:10) at Launcher.launch (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:170:41)
I recently moved the code from one server to another and now I cant seem to run any reports.
These are the steps I took to transfer the files to the new server
- Copied jsreportapp dir to new server
- Im using apache virtual hosts so I setup a new virtual host
- I then installed pm2 onto my server
- I then ran the following command
npm install jsreport-cli -g
to install jsreport - I then used this command
pm2 start server.js
to run the server
Is there anything I may have missed which needs to be ran in order to get the server working?
-
I also get the following error sometime
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
-
When I view my chrome debug network tab I keep seeing the following requests every few seconds
https://jsreport.intelli-sense.co.uk/socket.io/?EIO=3&transport=polling&t=NGgvLdW&sid=wSoCkXCAA157kWOVAAAA
and the response isService Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Apache/2.4.29 (Ubuntu) Server at jsreport.intelli-sense.co.uk Port 443
-
Did you copy between the same os/version/architecture?
This error is related to server-side chrome launch. Searching the internet I see here mentioned this can have something to do with not enough resources to launch chrome. Does your VM have enough resources?
-
Yes the servers are both hosted by AWS and they are using a t2.medium so the resource should be the exact same. I find it odd that sometimes the erros I receive are different which has made it hard for me to resolve.
-
I stopped my pm2 service and tried starting the node server
jsreport start
and after it tries to load I then get the same error in my console which means I cant start jsreport either2020-08-26T13:28:20.288Z - error: Error when processing render request input.on is not a function TypeError: input.on is not a function at new Interface (readline.js:206:11) at Object.createInterface (readline.js:74:10) at Promise (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:327:25) at new Promise (<anonymous>) at waitForWSEndpoint (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:326:10) at Launcher.launch (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:170:41) 2020-08-26T13:28:20.288Z - debug: Processing schedule schedule failed with : TypeError: input.on is not a function at new Interface (readline.js:206:11) at Object.createInterface (readline.js:74:10) at Promise (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:327:25) at new Promise (<anonymous>) at waitForWSEndpoint (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:326:10) at Launcher.launch (/var/www/html/jsreportapp/node_modules/puppeteer/lib/Launcher.js:170:41)
-
Maybe try to remove node_modules and run
npm install
again. Maybe something went wrong with the copy of the chrome binary...Also please check you have the same node.js version on both.
-
Thanks that has got be a bit further Im not receiving constant errors anymore, I only receive this error when I try and run a report
Error: Failed to launch the browser process! /var/www/html/jsreportapp/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome: error while loading shared libraries: libXtst.so.6: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md at onClose (/var/www/html/jsreportapp/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20) at Interface.helper_js_1.helper.addEventListener (/var/www/html/jsreportapp/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68) at Interface.emit (events.js:198:15) at Interface.EventEmitter.emit (domain.js:481:20) at Interface.close (readline.js:394:8) at Socket.onend (readline.js:172:10) at Socket.emit (events.js:198:15) at Socket.EventEmitter.emit (domain.js:481:20) at endReadableNT (_stream_readable.js:1139:12) at processTicksAndRejections (internal/process/task_queues.js:81:17)
-
I got it working by installing these packages
sudo apt install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
doubt I need al of them but Im happy its working now. - https://stackoverflow.com/questions/59112956/cant-use-puppeteer-error-failed-to-launch-chrome