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

Getting this Error while trying to connect to sql-cloud-proxy "Is the server running on that host and accepting TCP/IP connections?" #2334

Open
Umer-TMSF opened this issue Nov 22, 2024 · 2 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification.

Comments

@Umer-TMSF
Copy link

Question

Hi, I am facing this particular issue below while trying to connect to cloud-sql-proxy.

psql: error: connection to server at "127.0.0.1", port 5433 failed: Connection refused
   Is the server running on that host and accepting TCP/IP connections? 

I am running following steps

      # Step : Run Cloud SQL Proxy
      - name: Enable cloud SQL proxy to temp instance
        run: |
            curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.7.0/cloud-sql-proxy.linux.amd64
            chmod +x cloud-sql-proxy
            ./cloud-sql-proxy --port 5432 ${{ steps.secrets.outputs.POSTGRES_CONNECTION_NAME }}  --credentials-file google-creds.json > cloud-sql-proxy.out 2> cloud-sql-proxy.err < /dev/null &
            echo $!
            echo CLOUD_SQL_PROXY_PID=$(echo $!) >> $GITHUB_ENV
            sleep 5

and try to connect with pg-client using below command

PGPASSWORD=${{password}} psql -h 127.0.0.1 -p 5432 -U postgres -c 'SELECT NOW()'

I tried to change the port as well to see if port is already being used but still now luck.

Code

No response

Additional Details

No response

@Umer-TMSF Umer-TMSF added the type: question Request for information or clarification. label Nov 22, 2024
@jackwotherspoon jackwotherspoon added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Nov 22, 2024
@jackwotherspoon
Copy link
Collaborator

Thanks for raising this @Umer-TMSF 😄

The Cloud SQL Proxy normally outputs logs.

The sample you are using swallows the logs which is probably hiding the true cause of the error. Let me try and come up with a nice way from Github actions to output the Proxy logs.

@jackwotherspoon
Copy link
Collaborator

Will hopefully get around to testing this out this week, thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification.
Projects
None yet
Development

No branches or pull requests

2 participants