d-zone-org / d-zone

An ambient life simulation driven by user activity within a Discord server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'get' of undefined

SuperSayf opened this issue · comments

Hello, I'm not very experienced with Node.js, but I found this amazing project and wanted to try it. I deployed it to Heroku using the button on the ReadMe, and it built successfully, but as soon as I go to the webpage, it gives me a message that the server is not ready, and it crashes. I have made sure my bot token is working. I would appreciate any help, I'm not sure what I am doing wrong.

Here is the message I get on the webpage:

Imgur

Here are the logs:

2020-11-03T21:34:41.431285+00:00 app[api]: Set TOKEN config vars by user sayfullah.jumoorty@live.com
2020-11-03T21:34:42.000000+00:00 app[api]: Build started by user sayfullah.jumoorty@live.com
2020-11-03T21:35:10.188675+00:00 app[api]: Release v4 created by user sayfullah.jumoorty@live.com
2020-11-03T21:35:10.188675+00:00 app[api]: Deploy by user sayfullah.jumoorty@live.com
2020-11-03T21:35:10.203436+00:00 app[api]: Scaled to web@1:Free by user sayfullah.jumoorty@live.com
2020-11-03T21:35:12.000000+00:00 app[api]: Build succeeded
2020-11-03T21:35:14.331718+00:00 heroku[web.1]: Starting process with command node index.js
2020-11-03T21:35:16.979202+00:00 app[web.1]: Initializing server
2020-11-03T21:35:17.028842+00:00 app[web.1]: Websocket listening on port 14779
2020-11-03T21:35:17.311962+00:00 heroku[web.1]: State changed from starting to up
2020-11-03T21:35:56.260360+00:00 heroku[router]: at=info method=GET path="/" host=sayf-map.herokuapp.com request_id=d07eda23-7a4a-4db7-bcc4-e6b2609fb39e fwd="165.73.240.84" dyno=web.1 connect=1ms service=16ms status=200 bytes=710 protocol=https
2020-11-03T21:35:56.481193+00:00 heroku[router]: at=info method=GET path="/css/main.css" host=sayf-map.herokuapp.com request_id=a152a933-9570-4dec-a262-454b172aaa18 fwd="165.73.240.84" dyno=web.1 connect=1ms service=3ms status=304 bytes=237 protocol=https
2020-11-03T21:35:56.700581+00:00 heroku[router]: at=info method=GET path="/static/bundle.js" host=sayf-map.herokuapp.com request_id=a11ed508-875c-4843-a692-84703edb7e37 fwd="165.73.240.84" dyno=web.1 connect=1ms service=9ms status=200 bytes=124467 protocol=https
2020-11-03T21:35:57.680284+00:00 heroku[router]: at=info method=GET path="/img/environment.png" host=sayf-map.herokuapp.com request_id=a30952fb-4353-404f-a547-15397deb646b fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=238 protocol=https
2020-11-03T21:35:57.681620+00:00 heroku[router]: at=info method=GET path="/img/actors.png" host=sayf-map.herokuapp.com request_id=385b3a95-0b48-4043-93e7-0efee25c48e8 fwd="165.73.240.84" dyno=web.1 connect=1ms service=3ms status=304 bytes=237 protocol=https
2020-11-03T21:35:57.900325+00:00 heroku[router]: at=info method=GET path="/img/props.png" host=sayf-map.herokuapp.com request_id=d7fc507a-b7c1-4de4-92a3-5fc5ad11fa7c fwd="165.73.240.84" dyno=web.1 connect=1ms service=3ms status=304 bytes=237 protocol=https
2020-11-03T21:35:57.898203+00:00 heroku[router]: at=info method=GET path="/img/static-tiles.png" host=sayf-map.herokuapp.com request_id=192de220-a87e-47ba-8fe4-917c0e2e8b03 fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=238 protocol=https
2020-11-03T21:35:58.089536+00:00 heroku[router]: at=info method=GET path="/img/font.png" host=sayf-map.herokuapp.com request_id=b19566eb-444b-4988-95e8-26f77b3baf5d fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=237 protocol=https
2020-11-03T21:35:58.335394+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=sayf-map.herokuapp.com request_id=5d0aa29e-495d-41b4-afe4-7f199765cef6 fwd="165.73.240.84" dyno=web.1 connect=0ms service=3ms status=200 bytes=1355 protocol=https
2020-11-03T21:35:58.739605+00:00 app[web.1]: 11/3 9:35:58 PM client connected to server (1 total)
2020-11-03T21:36:00.302383+00:00 app[web.1]: /app/script/inbox.js:129
2020-11-03T21:36:00.302406+00:00 app[web.1]: let server = this.servers.get(connectRequest.server) ||
2020-11-03T21:36:00.302407+00:00 app[web.1]: ^
2020-11-03T21:36:00.302408+00:00 app[web.1]:
2020-11-03T21:36:00.302409+00:00 app[web.1]: TypeError: Cannot read property 'get' of undefined
2020-11-03T21:36:00.302409+00:00 app[web.1]: at Inbox.getUsers (/app/script/inbox.js:129:31)
2020-11-03T21:36:00.302411+00:00 app[web.1]: at onJoinServer (/app/index.js:18:27)
2020-11-03T21:36:00.302411+00:00 app[web.1]: at WebSocket. (/app/script/websock.js:43:17)
2020-11-03T21:36:00.302411+00:00 app[web.1]: at WebSocket.emit (events.js:314:20)
2020-11-03T21:36:00.302413+00:00 app[web.1]: at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:719:20)
2020-11-03T21:36:00.302413+00:00 app[web.1]: at Receiver.emit (events.js:314:20)
2020-11-03T21:36:00.302414+00:00 app[web.1]: at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:405:14)
2020-11-03T21:36:00.302414+00:00 app[web.1]: at Receiver.getData (/app/node_modules/ws/lib/receiver.js:346:17)
2020-11-03T21:36:00.302415+00:00 app[web.1]: at Receiver.startLoop (/app/node_modules/ws/lib/receiver.js:133:22)
2020-11-03T21:36:00.302415+00:00 app[web.1]: at Receiver._write (/app/node_modules/ws/lib/receiver.js:69:10)
2020-11-03T21:36:00.401784+00:00 heroku[web.1]: Process exited with status 1
2020-11-03T21:36:00.447695+00:00 heroku[web.1]: State changed from up to crashed
2020-11-03T21:36:00.450851+00:00 heroku[web.1]: State changed from crashed to starting
2020-11-03T21:36:00.311089+00:00 heroku[router]: at=info method=GET path="/" host=sayf-map.herokuapp.com request_id=d9e63480-17fc-473c-913e-cb05583a5689 fwd="165.73.240.84" dyno=web.1 connect=0ms service=1575ms status=101 bytes=129 protocol=https
2020-11-03T21:36:02.645684+00:00 heroku[web.1]: Starting process with command node index.js
2020-11-03T21:36:04.807820+00:00 app[web.1]: Initializing server
2020-11-03T21:36:04.834107+00:00 app[web.1]: Websocket listening on port 49940
2020-11-03T21:36:05.352245+00:00 heroku[web.1]: State changed from starting to up
2020-11-03T21:40:24.894336+00:00 heroku[router]: at=info method=GET path="/" host=sayf-map.herokuapp.com request_id=dfc7a210-334e-45b8-94b0-70f00ded455f fwd="165.73.240.84" dyno=web.1 connect=0ms service=7ms status=304 bytes=237 protocol=https
2020-11-03T21:40:25.116153+00:00 heroku[router]: at=info method=GET path="/css/main.css" host=sayf-map.herokuapp.com request_id=488f0201-05ca-4804-aea6-5c6e0830f0c3 fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=237 protocol=https
2020-11-03T21:40:25.326620+00:00 heroku[router]: at=info method=GET path="/static/bundle.js" host=sayf-map.herokuapp.com request_id=d6687da1-7524-4030-8617-381d68956a5e fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=239 protocol=https
2020-11-03T21:40:25.558668+00:00 heroku[router]: at=info method=GET path="/img/environment.png" host=sayf-map.herokuapp.com request_id=5f58a6e7-51a9-458d-9ea5-57b7cdcb50bc fwd="165.73.240.84" dyno=web.1 connect=1ms service=4ms status=304 bytes=238 protocol=https
2020-11-03T21:40:25.556478+00:00 heroku[router]: at=info method=GET path="/img/actors.png" host=sayf-map.herokuapp.com request_id=7e7f64fc-690d-4b92-ad11-12ed85ab1c68 fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=237 protocol=https
2020-11-03T21:40:25.770236+00:00 heroku[router]: at=info method=GET path="/img/static-tiles.png" host=sayf-map.herokuapp.com request_id=78c2b831-bfed-426e-ab7a-7761753cc068 fwd="165.73.240.84" dyno=web.1 connect=1ms service=2ms status=304 bytes=238 protocol=https
2020-11-03T21:40:25.960704+00:00 heroku[router]: at=info method=GET path="/img/props.png" host=sayf-map.herokuapp.com request_id=c1b97c43-4645-4dfb-918a-b3814d1cf389 fwd="165.73.240.84" dyno=web.1 connect=0ms service=2ms status=304 bytes=237 protocol=https
2020-11-03T21:40:25.972521+00:00 heroku[router]: at=info method=GET path="/img/font.png" host=sayf-map.herokuapp.com request_id=0252a2c1-f8fd-4c4a-a3d5-3ca724b01f3e fwd="165.73.240.84" dyno=web.1 connect=1ms service=2ms status=304 bytes=237 protocol=https
2020-11-03T21:40:26.207554+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=sayf-map.herokuapp.com request_id=8864126f-d100-410b-a3d9-fac7fb8500e7 fwd="165.73.240.84" dyno=web.1 connect=1ms service=6ms status=200 bytes=1355 protocol=https
2020-11-03T21:40:26.602126+00:00 app[web.1]: 11/3 9:40:26 PM client connected to server (1 total)
2020-11-03T21:40:28.546857+00:00 app[web.1]: /app/script/inbox.js:129
2020-11-03T21:40:28.546871+00:00 app[web.1]: let server = this.servers.get(connectRequest.server) ||
2020-11-03T21:40:28.546872+00:00 app[web.1]: ^
2020-11-03T21:40:28.546873+00:00 app[web.1]:
2020-11-03T21:40:28.546873+00:00 app[web.1]: TypeError: Cannot read property 'get' of undefined
2020-11-03T21:40:28.546873+00:00 app[web.1]: at Inbox.getUsers (/app/script/inbox.js:129:31)
2020-11-03T21:40:28.546874+00:00 app[web.1]: at onJoinServer (/app/index.js:18:27)
2020-11-03T21:40:28.546874+00:00 app[web.1]: at WebSocket. (/app/script/websock.js:43:17)
2020-11-03T21:40:28.546875+00:00 app[web.1]: at WebSocket.emit (events.js:314:20)
2020-11-03T21:40:28.546876+00:00 app[web.1]: at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:719:20)
2020-11-03T21:40:28.546876+00:00 app[web.1]: at Receiver.emit (events.js:314:20)
2020-11-03T21:40:28.546877+00:00 app[web.1]: at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:405:14)
2020-11-03T21:40:28.546877+00:00 app[web.1]: at Receiver.getData (/app/node_modules/ws/lib/receiver.js:346:17)
2020-11-03T21:40:28.546877+00:00 app[web.1]: at Receiver.startLoop (/app/node_modules/ws/lib/receiver.js:133:22)
2020-11-03T21:40:28.546878+00:00 app[web.1]: at Receiver._write (/app/node_modules/ws/lib/receiver.js:69:10)
2020-11-03T21:40:28.596005+00:00 heroku[web.1]: Process exited with status 1
2020-11-03T21:40:28.625618+00:00 heroku[web.1]: State changed from up to crashed
2020-11-03T21:40:28.549809+00:00 heroku[router]: at=info method=GET path="/" host=sayf-map.herokuapp.com request_id=467f6436-87dc-4574-a5d3-6f1504dd85fc fwd="165.73.240.84" dyno=web.1 connect=0ms service=1953ms status=101 bytes=129 protocol=https
2020-11-03T21:40:34.314134+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sayf-map.herokuapp.com request_id=cbfe9cb8-cb22-493c-bb6d-f00e95a287db fwd="165.73.240.84" dyno= connect= service= status=503 bytes= protocol=https
2020-11-03T21:40:34.623001+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sayf-map.herokuapp.com request_id=4fba25a2-f9eb-4361-934d-e93f647f77fc fwd="165.73.240.84" dyno= connect= service= status=503 bytes= protocol=https

Hey there, thanks for the detailed issue. You are probably not doing anything wrong, because I updated the heroku branch recently and it hasn't been tested well enough. I will take a look and see if I can fix this.

I have updated the branch to fix this. I'm not sure if you have to delete and create your heroku instance again to get the new code. Let me know how it goes.

I have updated the branch to fix this. I'm not sure if you have to delete and create your heroku instance again to get the new code. Let me know how it goes.

Thanks for the fast reply. I have deleted the old heroku app and re-installed the new one. The crashing has stopped thankfully, but the webpage is still stuck on "This server is not ready yet, try again shortly." I have waited for about 30 minutes with the new fix and nothing has changed. Does it usually take this long for the webpage to load?

Thanks for your time

Can you make sure that you have privileged intents enabled on your bot?

Can you make sure that you have privileged intents enabled on your bot?

Oh my god, I'm so silly, I did enable it, but I think I forgot to save the changes. My bad. Everything is now working perfectly. This project is really amazing, you have my praise. Also, thank you so much for the fast replies and super fast fix, you are awesome.

Kind regards,
Sayfullah

That's good to hear, thanks for helping me find that bug. And thanks for your kind words! ❤