unitaryfund/metriq-api

Unable to locally start web app from container

Opened this issue · 1 comments

I use Visual Studio Code (with Docker Desktop installed) on a Mac (Mac OS Catilina 10.15.7).

I updated the metriq-api git repository up to recent merge of #113.

In Visual Studio Code, I open the folder, which prompted a long installation (15 minutes, as it asked to install various extensions, including one for MongoDB), running the scripts contained in the Dockerfile:

added 2016 packages from 816 contributors and audited 2023 packages in 970.459s

If I go to the ports this is what it looks like:

Screen Shot 2021-08-13 at 13 30 31

If I open the ports in the browser,

  • http://localhost:27018/ reads It looks like you are trying to access MongoDB over HTTP on the native driver port.
  • http://localhost:3000/ is stuck on loading
  • http://localhost:8080/ gives the following error
UnauthorizedError: No authorization token was found
    at middleware (/workspace/metriq-api/node_modules/express-jwt/lib/index.js:79:21)
    at /workspace/metriq-api/index.js:34:12
    at Layer.handle [as handle_request] (/workspace/metriq-api/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/workspace/metriq-api/node_modules/express/lib/router/index.js:317:13)
    at /workspace/metriq-api/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/workspace/metriq-api/node_modules/express/lib/router/index.js:335:12)
    at next (/workspace/metriq-api/node_modules/express/lib/router/index.js:275:10)
    at cookieParser (/workspace/metriq-api/node_modules/cookie-parser/index.js:71:5)
    at Layer.handle [as handle_request] (/workspace/metriq-api/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/workspace/metriq-api/node_modules/express/lib/router/index.js:317:13)
    at /workspace/metriq-api/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/workspace/metriq-api/node_modules/express/lib/router/index.js:335:12)
    at next (/workspace/metriq-api/node_modules/express/lib/router/index.js:275:10)
    at jsonParser (/workspace/metriq-api/node_modules/body-parser/lib/types/json.js:110:7)
    at Layer.handle [as handle_request] (/workspace/metriq-api/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/workspace/metriq-api/node_modules/express/lib/router/index.js:317:13)

As a side comment, previously I was able to start, without the container, the API, DB and APP with:

in metriq-api: node index
brew services start mongodb-community
open mongodb compass and type `mongodb://localhost:27017/`
in metriq-db: 
mongoimport --db metriq --collection users users.json
mongoimport --db metriq --collection tags tags.json
mongoimport --db metriq --collection tasks tasks.json
mongoimport --db metriq --collection submissions submissions.json
mongoimport --db metriq --collection results results.json
mongoimport --db metriq --collection methods method.json
in metriq-app: npm start

but now I get an error. I did edit since the .bashrc file as advised in the Readme, skipping the lines that involved redacted tokens.

Just following up with @nathanshammah. Have the updated repos/instructions been useful at resolving the issues you're encountering here? Just pinging to see if this issue is still relevant, and if so, how we can help you out in resolving it.