0

I am trying to develop a simple HTTP API using sails framework. I have created models, controllers, helpers and routes in order to complete the workflow of the API but when I am lifting sails app in development mode , I am getting a timeout error for setting migrate=alter. After debugging on my own I got to the conclusion that my sails app is not connecting with the postgres.

I have installed all the related dependencies (ex. sails-postgresql, pg etc..), I am setting a correct URL in config.model file. I don't know what I am missing with this.. Any suggestions???

versions: sails-1.2.4, postgresql-12.4

edit: This is the error I am getting.

nirajrajput@Nirajs-MacBook-Pro demosails % node app.js
(node:29522) Warning: Accessing non-existent property 'padLevels' of 
module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was 
created)
info: ·• Auto-migrating...  (alter)
info:    Hold tight, this could take a moment.
error: Failed to lift app: Error: Sails is taking too long to load.

--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  
--  --  --
Troubleshooting tips:
-• Were you still reading/responding to an interactive prompt?
(Whoops, sorry!  Please lift again and try to respond a bit more 
quickly.)

-• Do you have a lot of stuff in `assets/`?  Grunt might still be 
running.
(Try increasing the hook timeout.  Currently it is 40000.
 e.g. `sails lift --hookTimeout=80000`)

-• Is `blueprints` a custom or 3rd party hook?
(*If* `initialize()` is using a callback, make sure it's being 
called.)
--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  
--  --  --

at Timeout.tooLong [as _onTimeout] (/Users/nirajrajput/demosails/node_modules/sails/lib/app/private/loadHooks.js:191:21)
at listOnTimeout (internal/timers.js:551:17)
at processTimers (internal/timers.js:494:7)
  • Please post the error. – Noitidart Aug 30 '20 at 23:15
  • @Noitidart thanks for the response. I have edited the que and added the error I am getting. – Niraj Rajput Aug 31 '20 at 05:34
  • Don't do `node app.js` do `sails lift`. and if that doesn't work then do `sails lift --hookTimeout=80000` – Noitidart Aug 31 '20 at 12:14
  • got the solution, there was some error due to the latest version of node. Thanks though @Noitidart – Niraj Rajput Sep 04 '20 at 15:20
  • I've faced the same problem, after swapping my node version from 14.8.0 to 13.2.0, I still couldn't get sails to connect to my postgres db, but this time it was complaining about the db user password that was missing. Strangely the error wasn't explicit when using the latest node version. – imad kimouche Sep 19 '20 at 06:16

0 Answers0