heroku console No route to host error - ruby

I have a simple Ruby app hosted on Heroku. It is not Rails app, it only uses Rack and Sinatra and it is running on cedar-14 stack.
When I try to run heroku run console or heroku run bash it prompts:
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: No route to host - connect(2) (Errno::EHOSTUNREACH)
Also, when I try to telnet as suggested here It prompts just the same
$ telnet rendezvous.heroku.com 5000
Trying 50.19.103.36...
telnet: Unable to connect to remote host: No route to host
and
$ telnet s1.runtime.heroku.com 5000
telnet: could not resolve s1.runtime.heroku.com/5000: Name or service not known
I'm not premium Heroku user.
Can I get that One-Off dyno and If I can how?

Related

Failed to connect openshift using oc client on wsl2

I am using wsl2 (Ubuntu) on windows, and I have been installed openshift client for windows, but when I run oc login (oc login https://myhost --token=myToken) on wls2, it returns "error: dial tcp: lookup "myhost" on xxx.xx.xxx.x:xx: read udp xxx.xx.xxx.xxx:xxxxx->xxx.xx.xxx.x:xx: i/o timeout - verify you have provided the correct host and port and that the server is currently running."
Note: When i run oc login on windows (cmd/powershell) it works
Any solutions?
Thank you.
UPDATE
The problem is because I'm using vpn(GlobalProtect) when connecting to openshift. When I disconnect the vpn, the oc command runs properly.
Is it possible to run the oc command while connected to vpn (GlobalProtect)?

Gatsby on EC2 doesn't connect externally

I have a development installation of Gatsby Doc site running on my EC2 server.
When I run the code on my dev machine it works and I can connect my browser to port 8000 and everything is ok..
On my server i check out my github code and
yarn install
npm run start.
Everything builds correctly and Gatsby it listening on port 8000
From my dev machine when I connect using
X.X.X.X:8000 in my browser i receive
Unable to connect
I have opened the port on 8000 in the firewall and I have tested that it works as expected using:
nc -lv 8000
on the server (where gatsby is going to run) and connect using telnet.
on the server i receive
Listening on [0.0.0.0] (family 0, port 8000)
Connection from 84.232.Y.Y 38552 received!
So it works.
When Gatsby is finished starting i see
You can now view gatsbyjs.org in the browser. ⠀ http://localhost:8000/
⠀
when i enter the web address and port i receive
Unable to connect
again. do I need to start Gatsby in another mode?
Kim
I found out.
I just added -H 0.0.0.0 to the start up command and everything works now.

AWS Lambda Connecting to Local Postgres in Docker

I'm attempting to connect to a local Postgres server running as a docker container from my Lambda function.
I'm using the sam local invoke call to do so.
For some reason, it seems that outgoing connection from SAM's docker container for the function is disabled.
I'm getting this error message:
"errorMessage": "(psycopg2.OperationalError) could not connect to server: Connection refused\n\tIs the server running on host \"localhost\" (127.0.0.1) and accepting\n\tTCP/IP connections on port 5432?\ncould not connect to server: Cannot assign requested address\n\tIs the server running on host \"localhost\" (::1) and accepting\n\tTCP/IP connections on port 5432?\n\n(Background on this error at: http://sqlalche.me/e/e3q8)",
Is there a way to enable a Lambda function call to a local docker database?
I have no issues running the connection code outside the Lambda function as standard Python code - so I'm sure my database is up, my code works, etc.
Try running the command with —docker-network TEXT per the AWS SAM CLI documentation.
I had a similar issue attempting to run sam local start-api with a local Docker Postgres database and was getting connection refused errors. I ran sam local start-api —docker-network host and it resolved the issue.
This is a good post which helped me to understand more about Docker networks.
Hope this helps you and any others looking at this.
I resolve this by replacing localhost with host.docker.internal.
For example if you use psycopg2
conn = psycopg2.connect(host="host.docker.internal",port=5432, ...)

Cannot access localhost:8080 from laravel

I have a PHP application running on homestead box. This application makes calls to another app that is running on glassfish on my localhost:8080.
When PHP application sends the request to localhost:8080, I am getting following error:
ConnectException in RequestException.php line 49:
cURL error 7: Failed to connect to localhost port 8080: Connection refused
Still I can make calls to localhost:8080 from web browser.Anyone has any suggestion?
Seeing how your application is running in Homestead (which by default is available on 192.168.10.10 and is forwarded to also be accessible on localhost:8000) your application running on Glassfish will not have access to it using localhost:8080. This is because localhost in your vagrant box (Homestead) is not actually the same localhost as on the host machine.
What you could do is grab the ip address from the host machine and connect to it from your application running in Homestead.
So here is how I could solve the problem. Vagrant is the guest machine running on my localhost as host machine. To access host from guest, you need to use gateway from VB.
I found this answer which helped me to access my application on localhost.

Heroku Postgres connection from another ec2 instance

How can i connect to heroku postgres from another webapplication running on different cloud service.
I have a heroku postgres. I have another webapplication running on EC2. When my webapp on ec2 is trying to connect to heroku app, it fails.
I tried telnet from ec2 instance to heroku postgres on port 5432, it fails.
Can anyone please provide a pointer?
You can use heroku pg:credentials command to get the credentials for your database. For example:
$ heroku pg:credentials DATABASE_URL
Connection info string:
"dbname=abcdefghijklmn host=ec2-1-2-3-4.compute-1.amazonaws.com port=5432 user=abcdefghijklmn password=abcdefghijklmnopqrstuvwxyz sslmode=require"
Connection URL:
postgres://abcdefghijklmn:abcdefghijklmnopqrstuvwxyz#ec2-1-2-3-4.compute-1.amazonaws.com:5432/abcdefghijklmn
Then, you can use Connection URL or decomposed credentials in your other application. Pay attention to sslmode=require. Connections to Heroku Postgres require you to use SSL, which is an "advanced" option in some of the PostgreSQL clients (e.g. Navicat). For example:
$ psql postgres://abcdefghijklmn:abcdefghijklmnopqrstuvwxyz#ec2-1-2-3-4.compute-1.amazonaws.com:5432/abcdefghijklmn
More information here: https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress

Resources