Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database connection error when running "npm run dev" #54

Open
yudhk opened this issue Mar 25, 2019 · 9 comments
Open

Database connection error when running "npm run dev" #54

yudhk opened this issue Mar 25, 2019 · 9 comments

Comments

@yudhk
Copy link

yudhk commented Mar 25, 2019

so everything was fine until the database connection I'am using postgresql 11.2 os : debian 9 is there any file that I have to change?

[05:27:36] Finished 'launchBrowserSync' after 247 ms
[05:27:36] Starting 'watchFiles'...
[05:27:36] Finished 'watchFiles' after 44 ms
[05:27:36] Finished 'dev' after 16 s
[IMAGES] config.images.cache true
[EMAIL] transport mailing – SUCCESS
[REDIS] connection – SUCCESS
[DATABASE] connection – ERROR
[SERVER] gracefully closing server…
waiting 1 to close
issue at server init Error: [DATABASE] connection – ERROR
at config.setup.then (/home/yudha/builder/server/index.js:630:30)
at
[SERVER] exiting process
[05:27:38] [nodemon] clean exit - waiting for changes before restart
DATABASE] connection – ERROR

@Hiswe
Copy link

Hiswe commented Mar 25, 2019

You need to check the server configuration if your DB doesn't match the default.

https://github.com/goodenough/mosaico-backend/blob/master/README.md#configuration

@yudhk
Copy link
Author

yudhk commented Mar 26, 2019

sorry but I'am a newbie and I really want to install this app on my server, I see the configuration file and it is look like this

onst config = rc('backend', {
debug: false,
forcessl: false,
host: 'localhost:3000',
database: 'postgres://localhost:5432/mosaico-backend',
redis: 'redis://localhost:6379',
emailTransport: {
host: 'localhost',
port: 1025,
},

is that mean that I have to create database and named it "mosaico-backend" and what the user and passwd are should be? because I haven't touch anything with the db configuration on my server I just installed the postgresql and go into the next step, but it says database connection error

@yudhk
Copy link
Author

yudhk commented Mar 27, 2019

so now I trying to install this on my ubuntu server and following the instruction to install this cool app, but I still got the same error "database connection error" could you tell me what is wrong with that, and I'm sure it is not because of my postgresql/database configuration since I don't do any configuration there, or maybe there is files that I have to configured?

@Hiswe
Copy link

Hiswe commented Mar 27, 2019

@yudhk For the DB you should have a mosaico-backend DB.
You have also to know on which port your DB is listening.

If it doesn't match the default configuration, you should create & edit a .backendrc (see the example file)
No need to change config.js

@yudhk
Copy link
Author

yudhk commented Mar 28, 2019 via email

@Hiswe
Copy link

Hiswe commented Mar 28, 2019

username & password have nothing to do with Node.
You should try to connect to your DB with a client and test your credentials there.
If you can make a connection, you will just have to report your config in the backend configuration

@yudhk
Copy link
Author

yudhk commented Mar 29, 2019

I have tried it, connect to the database with credentials and it's working fine, I don't know what I have to do next because I still got the same error, since it's just vps for testing purpose if you want to take a look on my vps server and maybe you can find what is wrong with that here are the auth : 144.202.116.161 name : root password Vs5)8vX.RgX)Zhmc I'll keep the server at least for 24 hour I put the mosaico file on /home/yudha/...

@Hiswe
Copy link

Hiswe commented Apr 6, 2019

DB url should be in format

postgres://db-user:db-password@db-url:db-port/db-name

@bradleytaftsmith
Copy link

I was able to solve very similar issue by adding user 'root' to my database roles, and providing adequate permissions with the specified database.

Specifying a username that DID have access using the format above in the .backendrc-example file did not solve my issue.

Sorted it by looking at db logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants