Error running Server.JS
Closed this issue · 13 comments
We are receiving the following error when running Server.js
[root@localhost trainingportal]# sudo -u scd node server.js
/opt/scd/SecureCodingDojo/trainingportal/server.js:161
app.get('/challenges/:moduleId', async (req, res) => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
==========================
We verified the version of NodeJS we are running:
[root@localhost trainingportal]# node -v
v6.17.1
[root@localhost trainingportal]#
Can you please advise if this is the right version of NodeJS? Or any other suggestions would be greatly appreciated.
Thanks
Hi, currently running on Node 10. Will update the readme. BTW did you know there's a docker image :) ?
Thanks for your help Paul. We are using Hyper-V instead of Docker in our environment, but I can see why Docker would be preferable XD
I'll install Node 10 and let you know how it goes. Thanks again 💯
I just updated the readme. Setup should be easier now. There are no more challenge keys or secrets only a challenge master salt.
Also the wiki should have lots of info on how to setup the dojo on a CentOS VM with node and everything else.
Excellent news! Can you provide any guidance on upgrading NodeJS to version 10? I've tried a number of ways with no success.
I'm referencing this article on the wiki: https://nodejs.org/en/download/package-manager/
If you're using CentOS should be: yum remove nodejs
and yum install nodejs10
PS: you can still install docker on your vm and run the container... then you can install nginx and forward to the container. The only caveat that the container is not the latest version.
We have tried installing docker but are experiencing the same errors mentioned in the other open issue by marevalo10. So I blew away my other non-docker version and reinstalled everything, including the proper version of nodeJS10. But now we get errors when running encryptConfigs.js I opened up a separate issue for this. Thanks for all of your help.
... I carried on with the non-docker approach and got to the end where I run the confis.js. Now I get this error:
[root@localhost trainingportal]# sudo -u scd node server.js
internal/crypto/cipher.js:164
const ret = this._handle.final();
^
Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
at Decipheriv.final (internal/crypto/cipher.js:164:28)
at Object.exports.decrypt (/opt/scd/SecureCodingDojo/trainingportal/aescrypto.js:24:25)
at Object. (/opt/scd/SecureCodingDojo/trainingportal/db.js:35:25)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
[root@localhost trainingportal]#
First of all I really appreciate your patience with this. Your experience and comments are very helpful to improve the project.
The issue you're hitting now could be related to this: https://github.com/trendmicro/SecureCodingDojo/wiki/Running-the-training-portal#what-could-go-wrong .
I just pushed some major changes including docker images. Documentation has not updated yet. If you want to go back to docker again it may be worth it to spare you the trouble of a VM setup.
I'm planning to update the readme and wiki next. The config.js is changed to config.json and simplified to avoid people running into issues like the above.
Thank you for the update. We will take another run at using docker for sure as my HyperV VM still gets errors even though I ensured that my encrypted variables are all populated. Glad to help and really appreciate your work on this
You should be able to just get it going with these steps: https://github.com/trendmicro/SecureCodingDojo#try-it
Just tested this morning.
Thanks, we're going to try again this week. Just been busy
Closing this since the issue was solved. Let me know if you have any other issues.