[Chat] Application Error Heroku

[Chat] Application Error Heroku

  
Forge Component
(32)
Published on 2015-11-24 by Hélio Dolores
32 votes
Published on 2015-11-24 by Hélio Dolores

Hello!


I'm Having trouble with installation. I followed the instruction in creating my Heroku account ( i even tried with Openhat)  and i then deployed the 2 files in the .ZIP (Package & Server.js) and when i click in Heroku "Open App" it says application error. I don't know what to do next. Heres the modified last lines of code:



I'm stock at the step of setting websockets. Any help?

Hello Luis,

The URL you provided in the Server.js appears to be wrong. "luisecheverarria@outsystemscloud.com" should be something like "luisecheverarria.outsystemscloud.com".

Can you try to change this and see what happens? 

Best regards,

Hélio

Hello Helio and thanks a lot for replying.

This is the new code:


I use Github to deploy to heroku:


This is the page i get when i press "Open App" on Heroku:



I'm using a personal enviroment:


I'm noticing some warnings about licensing. Don't know if it can be the problem:


Getting this message when running "Node server.js" on command prompt


Thanks for taking the time to help.

Hi Luis,

You can ignore the licensing error, it is only saying that the license you have doesn't support cache. But that's OK, don't worry.

When I did the Heroku testing I installed their console. Can't you access error logs?

To test the example on your computer's console you need to run the "npm install" command first so that you get all the application dependencies. Have you made it?

regards,

Hélio





Hi helio,

I could access the logs, Here there are:


Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\c2spr>cd C:\Users\c2spr\Desktop\ChatServer

C:\Users\c2spr\Desktop\ChatServer>heroku login
Enter your Heroku credentials:
Email: luisram7p@gmail.com
Password: ************
Logged in as luisram7p@gmail.com


C:\Users\c2spr\Desktop\ChatServer>heroku logs --app chattingoutsystem
2017-03-28T12:45:41.794900+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=chattingoutsystem.herokuapp.com request_id=18ce62e2-129a-44cb-9035-9ab65a813a7b fwd="80.251.174.45" dyno= connect= service= status=503 bytes= protocol=http
2017-03-28T13:00:19.681112+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=chattingoutsystem.herokuapp.com request_id=d3829b4b-6e91-4c87-a372-50489a40febe fwd="34.196.173.189" dyno= connect= service= status=503 bytes= protocol=http
2017-03-28T13:05:35.000000+00:00 app[api]: Build started by user luisram7p@gmail.com
2017-03-28T13:05:42.925495+00:00 app[api]: Deploy 5c34931 by user luisram7p@gmail.com
2017-03-28T13:05:42.925495+00:00 app[api]: Release v8 created by user luisram7p@gmail.com
2017-03-28T13:05:35.000000+00:00 app[api]: Build succeeded
2017-03-28T13:05:43.278378+00:00 app[api]: Release v8 created by user luisram7p@gmail.com
2017-03-28T13:05:43.737521+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-28T13:05:45.547549+00:00 heroku[web.1]: Starting process with command `npm start`
2017-03-28T13:05:48.733617+00:00 app[web.1]:
2017-03-28T13:05:48.733637+00:00 app[web.1]: > Server@1.0.0 start /app
2017-03-28T13:05:48.733639+00:00 app[web.1]:
2017-03-28T13:05:48.893658+00:00 app[web.1]: /app/node_modules/socket.io/lib/store.js:35
2017-03-28T13:05:48.893661+00:00 app[web.1]: Store.prototype.__proto__ = EventEmitter.prototype;
2017-03-28T13:05:48.893662+00:00 app[web.1]:                                         ^
2017-03-28T13:05:48.893663+00:00 app[web.1]:
2017-03-28T13:05:48.893663+00:00 app[web.1]: TypeError: Cannot read property 'prototype' of undefined
2017-03-28T13:05:48.893665+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/socket.io/lib/store.js:35:41)
2017-03-28T13:05:48.893665+00:00 app[web.1]:     at Module._compile (module.js:571:32)
2017-03-28T13:05:48.893666+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
2017-03-28T13:05:48.893666+00:00 app[web.1]:     at Module.load (module.js:488:32)
2017-03-28T13:05:48.893666+00:00 app[web.1]:     at tryModuleLoad (module.js:447:12)
2017-03-28T13:05:48.893667+00:00 app[web.1]:     at Function.Module._load (module.js:439:3)
2017-03-28T13:05:48.893667+00:00 app[web.1]:     at Module.require (module.js:498:17)
2017-03-28T13:05:48.893668+00:00 app[web.1]:     at require (internal/module.js:20:19)
2017-03-28T13:05:48.893668+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/socket.io/lib/manager.js:16:13)
2017-03-28T13:05:48.893669+00:00 app[web.1]:     at Module._compile (module.js:571:32)
2017-03-28T13:05:48.899519+00:00 app[web.1]:
2017-03-28T13:05:48.733638+00:00 app[web.1]: > node server.js
2017-03-28T13:05:48.908310+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-03-28T13:05:48.908564+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-03-28T13:05:48.908782+00:00 app[web.1]: npm ERR! node v7.7.4
2017-03-28T13:05:48.908976+00:00 app[web.1]: npm ERR! npm  v4.1.2
2017-03-28T13:05:48.909165+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-03-28T13:05:48.909326+00:00 app[web.1]: npm ERR! Server@1.0.0 start: `node server.js`
2017-03-28T13:05:48.909471+00:00 app[web.1]: npm ERR! Exit status 1
2017-03-28T13:05:48.909627+00:00 app[web.1]: npm ERR!
2017-03-28T13:05:48.909771+00:00 app[web.1]: npm ERR! Failed at the Server@1.0.0 start script 'node server.js'.
2017-03-28T13:05:48.909913+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-03-28T13:05:48.910056+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the Server package,
2017-03-28T13:05:48.910198+00:00 app[web.1]: npm ERR! not with npm itself.
2017-03-28T13:05:48.910350+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-03-28T13:05:48.910442+00:00 app[web.1]: npm ERR!     node server.js
2017-03-28T13:05:48.910542+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-03-28T13:05:48.910614+00:00 app[web.1]: npm ERR!     npm bugs Server
2017-03-28T13:05:48.910715+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-03-28T13:05:48.910783+00:00 app[web.1]: npm ERR!     npm owner ls Server
2017-03-28T13:05:48.910871+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-03-28T13:05:48.918477+00:00 app[web.1]:
2017-03-28T13:05:48.918645+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-03-28T13:05:48.918723+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-03-28T13:05:49.048405+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-28T13:05:49.049439+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-28T13:05:49.026621+00:00 heroku[web.1]: Process exited with status 1
2017-03-28T13:05:51.390029+00:00 heroku[web.1]: Starting process with command `npm start`
2017-03-28T13:05:55.551095+00:00 app[web.1]: /app/node_modules/socket.io/lib/store.js:35
2017-03-28T13:05:55.551103+00:00 app[web.1]: Store.prototype.__proto__ = EventEmitter.prototype;
2017-03-28T13:05:55.551104+00:00 app[web.1]:                                         ^
2017-03-28T13:05:55.551105+00:00 app[web.1]:
2017-03-28T13:05:55.551105+00:00 app[web.1]: TypeError: Cannot read property 'prototype' of undefined
2017-03-28T13:05:55.551118+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/socket.io/lib/store.js:35:41)
2017-03-28T13:05:55.551119+00:00 app[web.1]:     at Module._compile (module.js:571:32)
2017-03-28T13:05:55.551119+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
2017-03-28T13:05:55.551120+00:00 app[web.1]:     at Module.load (module.js:488:32)
2017-03-28T13:05:55.551120+00:00 app[web.1]:     at tryModuleLoad (module.js:447:12)
2017-03-28T13:05:55.551122+00:00 app[web.1]:     at Module.require (module.js:498:17)
2017-03-28T13:05:55.551121+00:00 app[web.1]:     at Function.Module._load (module.js:439:3)
2017-03-28T13:05:55.551122+00:00 app[web.1]:     at require (internal/module.js:20:19)
2017-03-28T13:05:55.551123+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/socket.io/lib/manager.js:16:13)
2017-03-28T13:05:55.551123+00:00 app[web.1]:     at Module._compile (module.js:571:32)
2017-03-28T13:05:55.563784+00:00 app[web.1]:
2017-03-28T13:05:55.587992+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-03-28T13:05:55.587996+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-03-28T13:05:55.587997+00:00 app[web.1]: npm ERR! npm  v4.1.2
2017-03-28T13:05:55.587997+00:00 app[web.1]: npm ERR! node v7.7.4
2017-03-28T13:05:55.587998+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-03-28T13:05:55.587999+00:00 app[web.1]: npm ERR! Server@1.0.0 start: `node server.js`
2017-03-28T13:05:55.587999+00:00 app[web.1]: npm ERR! Exit status 1
2017-03-28T13:05:55.588000+00:00 app[web.1]: npm ERR!
2017-03-28T13:05:55.588001+00:00 app[web.1]: npm ERR! Failed at the Server@1.0.0 start script 'node server.js'.
2017-03-28T13:05:55.588007+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-03-28T13:05:55.588189+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the Server package,
2017-03-28T13:05:55.588538+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-03-28T13:05:55.588300+00:00 app[web.1]: npm ERR! not with npm itself.
2017-03-28T13:05:55.588540+00:00 app[web.1]: npm ERR!     node server.js
2017-03-28T13:05:55.588712+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-03-28T13:05:55.588714+00:00 app[web.1]: npm ERR!     npm bugs Server
2017-03-28T13:05:55.588859+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-03-28T13:05:55.588873+00:00 app[web.1]: npm ERR!     npm owner ls Server
2017-03-28T13:05:55.589032+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-03-28T13:05:55.624529+00:00 app[web.1]:
2017-03-28T13:05:55.624802+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-03-28T13:05:55.624900+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-03-28T13:05:55.750635+00:00 heroku[web.1]: Process exited with status 1
2017-03-28T13:05:55.776996+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-28T13:05:55.296691+00:00 app[web.1]:
2017-03-28T13:05:55.296704+00:00 app[web.1]: > Server@1.0.0 start /app
2017-03-28T13:05:55.296705+00:00 app[web.1]: > node server.js
2017-03-28T13:05:55.296706+00:00 app[web.1]:
2017-03-28T13:06:09.101766+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=chattingoutsystem.herokuapp.com request_id=db2bf980-1b2c-4593-b82c-021572f73de4 fwd="66.231.167.30" dyno= connect= service= status=503 bytes= protocol=https
2017-03-28T13:06:09.568953+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=chattingoutsystem.herokuapp.com request_id=b2fadab5-253b-434e-a89e-1b0766f1a1f7 fwd="66.231.167.30" dyno= connect= service= status=503 bytes= protocol=https

C:\Users\c2spr\Desktop\ChatServer>

Hi Luis, 

This appears to be a dependency issue with the latest nodejs.

Can you please edit the package.json to use an older version?

"engines": {
        "node": "6.9.4"

I believe the problem started in version 7.

Hélio



Hi Helio,


That was exactly it!!!! I created a new heroku app, reinitialized everything from scratch and changed the version to the one you mentioned.




I get the "done!" message. I'm supposed to get a message saying "Welcome to socket.io" also right? I'm using the links in the setup page of "Chat"


This is the server.js now:


Should i uncomment that last line of code?



Thanks for the help!!!

Hi again Luis,

You don't need to uncomment that line (that's generated by the Typescript compiler).

Everything is fine in Heroku (I've checked). The "Welcome to socket.io" appears if you access the  <server>/socket.io page.

Now you just need to setup the server (users etc)

best,

Hélio



Hi Helio,


Thanks for all the help you've given me. 


One last step i think:


I inserted the widget on another app but when i deploy and show in browser i don't see the chat itself.


Hi Luis,

In the first image, in the Users tab, have you given permissions to your runtime user you are using for testing?

Hélio

Yes, my own user.

I suppose you have two different users logged in in different sessions. Can you check if you have any errors in your console?

BackOffice


Users



My app dependencies



The script



Result (Ticked the load unsafe scripts with chrome)


Can you try to access with http instead of https

This may be a cross protocol issue.

Hélio

no https

Can you create a user for me and send me a PM?

PM Sent. 


Hi Luis,

The problem was this extra bar at the end of the URL that was generating invalid URLs (.com/:80) 

Great to see this working!

Best regards,

Hélio