简体   繁体   English

Rails Postgres Github 操作错误:PG::ConnectionBad:fe_sendauth:未提供密码

[英]Rails Postgres Github Actions error: PG::ConnectionBad: fe_sendauth: no password supplied

I am trying to get a Rails app build and test working on Github Actions using Postgresql, based on the configuration shown in this article and this article .我正在尝试基于本文本文中显示的配置,使用 Postgresql 构建和测试在 Github 操作上工作的 Rails 应用程序。 When I push a branch to Github to kick off the action, I get the following error when the tests are run:当我将分支推送到 Github 以启动操作时,运行测试时出现以下错误:

PG::ConnectionBad: fe_sendauth: no password supplied PG::ConnectionBad: fe_sendauth: 未提供密码

I provided the username and password for the database as shown in those articles, why is it failing?如那些文章中所示,我提供了数据库的用户名和密码,为什么会失败?

[...]

jobs:
  test:

    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:13
        ports:
          - 5432:5432
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

    [...]
    - name: Install postgres
      run: sudo apt-get install libpq-dev
    - name: Install dependencies
      run: bundle install
    - name: Setup database
      env:
        RAILS_ENV: test
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: postgres
      run: |
        cp config/database.yml.github-actions config/database.yml
        bundle exec rake db:create
        bundle exec rake db:schema:load
    - name: Run tests
      run: bundle exec rake

The issue is a simple omission from the configuration file: I set the env variables section for the Setup database step, but not the Run tests step.问题是配置文件中的一个简单遗漏:我为Setup database步骤设置了env变量部分,但没有为Run tests步骤设置。 As a result, the error is correct, during that step, there is no username/password being provided so it cannot connect to the DB server.结果,错误是正确的,在该步骤中,没有提供用户名/密码,因此无法连接到数据库服务器。 Adding it to the test step solves the problem:将其添加到测试步骤可以解决问题:

- name: Run tests
  run: bundle exec rake
  env:
    RAILS_ENV: test
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PG :: ConnectionBad fe_sendauth:未提供密码 - PG::ConnectionBad fe_sendauth: no password supplied PG::ConnectionBad: fe_sendauth: 未提供密码 - PG::ConnectionBad: fe_sendauth: no password supplied Rails / PostgreSQL问题:PG :: ConnectionBad:fe_sendauth:未提供密码 - Rails/PostgreSQL problem: PG::ConnectionBad: fe_sendauth: no password supplied capistrano,rails,PG :: ConnectionBad:fe_sendauth:没有提供密码 - capistrano, rails, PG::ConnectionBad: fe_sendauth: no password supplied Rails 控制台导致 PG::ConnectionBad: fe_sendauth: 没有提供密码 - Rails Console results in PG::ConnectionBad: fe_sendauth: no password supplied 将密码存储在 Rails 中的 ENV 变量中时收到“PG::ConnectionBad fe_sendauth:未提供密码”错误 - receiving “PG::ConnectionBad fe_sendauth: no password supplied” error when storing passwords in ENV variables in rails 耙终止:PG :: ConnectionBad:fe_sendauth:未提供密码 - rake aborted:PG::ConnectionBad: fe_sendauth: no password supplied 修复方法:PG :: ConnectionBad:fe_sendauth:未提供密码 - how to fix: PG::ConnectionBad: fe_sendauth: no password supplied 'initialize':fe_sendauth:不提供密码(PG :: ConnectionBad) - `initialize': fe_sendauth: no password supplied (PG::ConnectionBad) 耙子流产了! PG :: ConnectionBad:fe_sendauth:没有提供密码 - rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM