简体   繁体   中英

Internal Server Error on heroku sails deploy

I am trying to deploy my sails.js app to heroku. I have deployed it but whenever I open a page which requires data from DB it says Internal Server Error . I think it might be a problem with my DB connection. I have created a postgresql DB on heroku and have set the connections in connections.js. Connection.js code is

module.exports.connections = {
     'mysql-adapter': {
         module: 'sails-mysql',
         url: "postgres://username:pass@ec2-107-22-249-214.compute-1.amazonaws.com:5432/dcebipdspqn7rn",
         port: 5432,
         schema:true
     }
};

I have been searching on the net for 2 days and have tried many tweaks but none has worked for me. Kindly tell me how to solve this issue. Thanks in advance.

UPDATE:

I checked the logs and it says

←[33m2015-02-25T14:20:38.793179+00:00 app[web.1]:←[0m  Could not render view "displayroute/viewRoute".  Tried locating view file @ "/app/views/displayroute/view
Route". Layout configured as "layout", so tried using layout @ "/app/views/layout")

However, the view is rendered correctly on localhost.

Your connection definition looks completely wrong and schema key should be in the models config object (either in config/models.js or in the api/models/YourModelDefinition.js or on the sails.config.models object).

I would reference the examples in connections.js found here https://github.com/balderdashy/sails-docs/blob/master/anatomy/myApp/config/connections.js.md

Remember that if you are using postgres then you need to install the adapter

npm install sails-postgresql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM