llaske / sugarizer-server

Sugarizer Server allow deployment of Sugarizer on a local server, for example on a school server.
Apache License 2.0
42 stars 92 forks source link

Getting internal server error when trying to make a admin account #310

Closed saga0p closed 2 years ago

saga0p commented 2 years ago

sh add-admin.sh admin password http://127.0.0.1:80/auth/signup

I'm using this command in docker container CLI and it throws back internal server error

*HTTP/1.1 500 Internal Server Error X-Powered-By: Express Access-Control-Allow-Origin: Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, PATCH, DELETE Access-Control-Allow-Headers: x-key,x-access-token Content-Security-Policy: default-src 'self' X-Content-Type-Options: nosniff Content-Type: text/html; charset=utf-8 Content-Length: 1145 set-cookie: connect.sid=s%3AekPmznPSJSB7vLeu6KKsNbCBeU6bEyuJ.r%2FVDIuOr9H%2Bu95PD4YFpGMp8DvuM9yJ1UE%2FQ0p5mF2c; Path=/; Expires=Mon, 21 Mar 2022 06:45:08 GMT; HttpOnly Date: Sat, 19 Mar 2022 06:45:08 GMT Connection: keep-alive

<!DOCTYPE html>

Error in JSON at position 14
   at JSON.parse (<anonymous>)
   at exports.checkAdminOrLocal (/sugarizer-server/api/controller/auth.js:354:19)
   at Layer.handle [as handle_request] (/sugarizer-server/node_modules/express/lib/router/layer.js:95:5)
   at next (/sugarizer-server/node_modules/express/lib/router/route.js:137:13)
   at Route.dispatch (/sugarizer-server/node_modules/express/lib/router/route.js:112:3)
   at Layer.handle [as handle_request] (/sugarizer-server/node_modules/express/lib/router/layer.js:95:5)
   at /sugarizer-server/node_modules/express/lib/router/index.js:281:22
   at Function.process_params (/sugarizer-server/node_modules/express/lib/router/index.js:335:12)
   at next (/sugarizer-server/node_modules/express/lib/router/index.js:275:10)
   at serveStatic (/sugarizer-server/node_modules/serve-static/index.js:75:16) **
saga0p commented 2 years ago

can anyone please help to resolve this

llaske commented 2 years ago

Could you explain the context? Are you using Docker or are you using directly node.js?

saga0p commented 2 years ago

I'm using docker(container CLI) for this. As running this command directly on nodejs in VScode integrated terminal is giving permission issues

llaske commented 2 years ago

You should launch this command from inside the Docker container. It means attaching a bash shell on the running docker instance to launch the command. If you're not familiar with docker, you could attach a bash to an instance by running:

docker exec -it <IdOfDockerForSugarizerServer> /bin/bash