Mystery DATABASE_USER=ubuntu Setting

I’m trying to set up a build environment with PG10. Despite my best efforts I cannot resolve this error:

PG::ConnectionBad: FATAL:  role "ubuntu" does not exist

I’ve tracked this down to an ENV variable DATABASE_USER being set to “ubuntu”. I cannot figure out how or where this variable comes from. I rely upon this env var being set correctly for all of my Rake tasks involving my database connection. Given the size of my app and the effort involved, renaming this variable is too much of a pain. Where does this come from? Why can’t I stomp on this variable? How does I fix this?

Many thanks in advance for any help.

Sounds rather similar to this issue that popped up recently - upstream changes in the official PostgreSQL image:

Have you tried setting POSTGRES_USER = ubuntu in your build environment variables settings?

Hmmm, yes this does kind of sound like that issue. I’ve even tried the override like @rose mentions here Convenience Images Update: Removing Hardcoded Postgres User

OK, so I’ve tracked this down to /.circleci-runner-config.json. There’s a line like this:

"Environment":{"CIRCLE_JOB":"set_up_environment","DATABASE_HOST":"localhos

t",“DATABASE_USERNAME”:“ubuntu”},“CircleEnvs”:{“BASH_ENV”:"/tmp/.bash_env-5ba2560858509c00013d28ed-0-build",“CI”:“true”,“CIRCLECI”:“true”,“CIRCLE_BRANCH”:“circle-ci”,“CIRCLE_BUILD_NUM”:“8465”

It turns out I had set some environment variables in the Build Settings of my project. Woo! I’m glad to have tracked this down. It was definitely a fun mystery.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.