(invalid_authorization_specification) role "runner" does not exist

Hey All,

I’m having an issue setting up Github actions. I’ve found this helpful link for standard elixir workflow .yml files: https://github.com/actions/setup-elixir

Here is my current elixir.yml

name: Elixir CI

on: push

jobs:
  test:
    runs-on: ubuntu-latest

    services:
      db:
        image: postgres:11
        ports: ['5432:5432']
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - uses: actions/checkout@v1.0.0
      - uses: actions/setup-elixir@v1.0.0
        with:
          otp-version: 22.x
          elixir-version: 1.9.2
      - run: mix deps.get
      - run: mix test

But when this runs I’m getting this error during the mix test portion:

01:16:43.654 [error] GenServer #PID<0.7572.0> terminating
** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification) role "runner" does not exist
    (db_connection) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
** (Mix) The database for Statcasters.Repo couldn't be created: killed
##[error]Process completed with exit code 1.

Can anybody help me understand what is going on here? Thank you!

@Cam Did you get it fixed? I’m having the same issue.

I didn’t see the string runner anywhere in the link to setup_elixir; is that something coming from the Phoenix application’s config?

You may need to configure the postgres container this sets up, to get the right user + database - check the Docker Hub page for a description of the available options. My parsing of the Actions docs is that you’ll want to add them under the db key in the above YAML.

1 Like

I used a GitHub-Actions file from another project, and it turned out that the new one didn’t have defined the username and password for the database connection on the config/test.exs. But, it was working locally using the default credentials of the user running the test.

The solution was to add username and password on config/dev.exs as @al2o3cr suggested.

1 Like