meatier icon indicating copy to clipboard operation
meatier copied to clipboard

Setting DATABASE_HOST generates connection errors

Open tribou opened this issue 9 years ago • 4 comments

Issue - Bug

  • OS: OSX
  • Node version: v4.4.4
  • NPM version: 3.9.0
  • RethinkDB version: 2.3.2

I'm trying to get meatier to connect to a local Docker container of rethinkdb. I set the DATABASE_HOST in the .env file, but I'm still getting this error when I run npm run quickstart (as it's still trying to connect to 127.0.0.1):

Fail to create a new connection for the connection pool. Error:{"message":"Failed to connect to localhost:28015\nFull error:\n{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\",\"address\":\"127.0.0.1\",\"port\":28015}.","isOperational":true}

Also, I'm able to connect to the RethinkDB administration URL on the container just fine...

tribou avatar May 17 '16 12:05 tribou

can you verify that rethinkdb is currently running on 28015? Also try to debug getRethinkConfig and see if it's picking up your process variables, since it'll default to localhost

mattkrick avatar May 17 '16 13:05 mattkrick

Thanks, I'll try debugging the getRethinkConfig... DATABASE_HOST is set to 192.168.99.100, so since the error is still specifying localhost, it's gotta be missing the dotenv config somewhere.

tribou avatar May 17 '16 18:05 tribou

Actually there is no call to getDotenv function to expand process.ENV variables in setupDB script Quick fix, add to the beginning of file src/server/database/getRethinkConfig.js

import {getDotenv} from '../../universal/utils/dotenv';
getDotenv();

harscoet avatar May 24 '16 13:05 harscoet

fixed by set DATABASE_HOST=127.0.0.1 in the file .env

devqin avatar Dec 28 '16 09:12 devqin