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

Error: getting tunnel url: didn't find tunnels that were expected to be created #92

Closed
NeckBeardPrince opened this issue Mar 29, 2018 · 7 comments

Comments

@NeckBeardPrince
Copy link

NeckBeardPrince commented Mar 29, 2018

$ atlantis version
atlantis 0.3.5

$ atlantis bootstrap
Welcome to Atlantis bootstrap!

This mode walks you through setting up and using Atlantis. We will

  • fork an example terraform project to your username
  • install terraform (if not already in your PATH)
  • install ngrok so we can expose Atlantis to GitHub
  • start Atlantis

Press Ctrl-c at any time to exit

GitHub username: NeckBeardPrince

To continue, we need you to create a GitHub personal access token
with "repo" scope so we can fork an example terraform project.

Follow these instructions to create a token (we don't store any tokens):
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token

  • use "atlantis" for the token description
  • add "repo" scope
  • copy the access token

GitHub access token (will be hidden):
=> forking repo
=> fork completed!
=> terraform found in $PATH!
=> downloading ngrok
=> downloaded ngrok successfully!
=> creating secure tunnel
=> started tunnel!
Error: getting tunnel url: didn't find tunnels that were expected to be created

Usage:
atlantis bootstrap [flags]

Flags:
-h, --help help for bootstrap

@lkysow
Copy link
Member

lkysow commented Mar 29, 2018

That error message should definitely be improved. Is it possible you're already running ngrok somewhere?

Can you paste the output of curl localhost:4040/api/tunnels? We throw that error if there's more than 2 tunnels in the output. I know the bootstrap exits right away so you won't be able to do that curl while it's running but if you do it before and you see some existing tunnels then that would explain the issue. If you stop the existing tunnel then that will fix the issue.

The code should be changed though so that it looks for the tunnel running on 4141 and then it will work with multiple tunnels running at the same time.

@lkysow
Copy link
Member

lkysow commented Mar 29, 2018

@NeckBeardPrince... 😆 I pushed 0.3.6 which should work for you (or at least give a better error): https://github.com/runatlantis/atlantis/releases/tag/v0.3.6

@NeckBeardPrince
Copy link
Author

NeckBeardPrince commented Mar 30, 2018

@lkysow Sorry for the delay.
Not running ngrok.

Updated to 0.3.6

$ atlantis bootstrap
Welcome to Atlantis bootstrap!

This mode walks you through setting up and using Atlantis. We will

  • fork an example terraform project to your username
  • install terraform (if not already in your PATH)
  • install ngrok so we can expose Atlantis to GitHub
  • start Atlantis

Press Ctrl-c at any time to exit

GitHub username: neckbeardprince

To continue, we need you to create a GitHub personal access token
with "repo" scope so we can fork an example terraform project.

Follow these instructions to create a token (we don't store any tokens):
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token

  • use "atlantis" for the token description
  • add "repo" scope
  • copy the access token

GitHub access token (will be hidden):
=> forking repo
=> fork completed!
=> terraform found in $PATH!
=> downloading ngrok
=> downloaded ngrok successfully!
=> creating secure tunnel
=> started tunnel!
Error: getting tunnel url: did not find ngrok tunnel with proto 'https' and config.addr 'localhost:4141' in list of tunnels at http://localhost:41414/api/tunnels

$ curl localhost:4040/api/tunnels
curl: (7) Failed to connect to localhost port 4040: Connection refused

$ curl localhost:4041/api/tunnels
curl: (7) Failed to connect to localhost port 4041: Connection refused

$ ps aux | grep ngrok
user 77924 0.0 0.0 4278592 1068 s006 R+ 12:04PM 0:00.00 grep --color=auto ngrok

@lkysow lkysow reopened this Mar 30, 2018
@lkysow
Copy link
Member

lkysow commented Mar 30, 2018

Hmm okay there's something else then. Can you manually run the ngrok command we're running? We must not be capturing the error there properly:

cat >> config.yml <<EOF
web_addr: localhost:41414
tunnels:
  atlantis:
    addr: 4141
    bind_tls: true
    proto: http
EOF
/tmp/ngrok start atlantis --config config.yml

If it says there's no ngrok in /tmp/ngrok then download it from https://ngrok.com/download.

Also what OS are you on? Thanks!

@NeckBeardPrince
Copy link
Author

NeckBeardPrince commented Apr 2, 2018

@lkysow Again, sorry for the delay.

Here is the stout log from ngrok

t=2018-04-02T10:52:45-0500 lvl=info msg="open config file" path=/Users/neckbeardprince/Source/atlantis/config.yml err=nil
t=2018-04-02T10:52:45-0500 lvl=info msg="run component" obj=controller comp=consoleui
t=2018-04-02T10:52:45-0500 lvl=info msg="run component" obj=controller comp="memory storage"
t=2018-04-02T10:52:45-0500 lvl=info msg="run component" obj=controller comp="Tunnel session"
t=2018-04-02T10:52:45-0500 lvl=info msg="run component" obj=controller comp=web
t=2018-04-02T10:52:45-0500 lvl=info msg="run component" obj=controller comp=updater
t=2018-04-02T10:52:45-0500 lvl=info msg="starting web service" obj=web addr=localhost:41414
t=2018-04-02T10:52:55-0500 lvl=eror msg="failed to reconnect session" obj=csess id=98128734bcda err="read tcp 10.11.20.170:50712->52.15.189.165:443: i/o timeout"
t=2018-04-02T10:53:06-0500 lvl=eror msg="failed to reconnect session" obj=csess id=98128734bcda err="read tcp 10.11.20.170:50717->52.15.189.165:443: i/o timeout"
t=2018-04-02T10:53:07-0500 lvl=eror msg="failed to reconnect session" obj=csess id=98128734bcda err="dial tcp [2600:1f16:59e:b200:7dc6:8c66:d95b:e236]:443: connect: no route to host"
t=2018-04-02T10:53:10-0500 lvl=eror msg="failed to reconnect session" obj=csess id=98128734bcda err="invalid character '<' looking for beginning of value"
t=2018-04-02T10:53:24-0500 lvl=eror msg="failed to reconnect session" obj=csess id=98128734bcda err="read tcp 10.11.20.170:50727->18.216.22.45:443: i/o timeout"
t=2018-04-02T10:53:30-0500 lvl=info msg="tunnel session started" obj=tunSess
t=2018-04-02T10:53:30-0500 lvl=info msg="client session established" obj=csess id=98128734bcda
t=2018-04-02T10:54:44-0500 lvl=info msg="Got quit command" obj=consoleui
t=2018-04-02T10:54:44-0500 lvl=info msg="component stopped" obj=controller comp=consoleui err=nil
t=2018-04-02T10:54:44-0500 lvl=info msg="requesting shutdown" obj=controller
t=2018-04-02T10:54:44-0500 lvl=info msg="component stopped" obj=controller comp="memory storage" err=nil
t=2018-04-02T10:54:44-0500 lvl=info msg="component stopped" obj=controller comp=web err=nil
t=2018-04-02T10:54:44-0500 lvl=info msg="component stopped" obj=controller comp=updater err=nil
t=2018-04-02T10:54:44-0500 lvl=info msg="session closing" obj=tunSess err=nil
t=2018-04-02T10:54:44-0500 lvl=info msg="component stopped" obj=controller comp="Tunnel session" err=nil
t=2018-04-02T10:54:44-0500 lvl=info msg="accept failed" obj=csess id=98128734bcda err="reconnecting session closed"
t=2018-04-02T10:54:44-0500 lvl=info msg="all component stopped" obj=controller

After the few errors it did end up connecting.

Here is the config

$ cat config.yml
web_addr: localhost:41414
tunnels:
  atlantis:
    addr: 4141
    bind_tls: true
    proto: http

OSX 10.13.3

@lkysow
Copy link
Member

lkysow commented Apr 3, 2018

Okay thanks, so I think I need to follow the logs and wait until we see client session established, then move on to the rest of the script.

For my reference, need to run with --log stdout --log-format json.

Thanks for your help, I'll get to this asap.

@NeckBeardPrince
Copy link
Author

@lkysow Awesome, glad I could break stuff for you :)

lkysow added a commit that referenced this issue May 30, 2018
Previously, we started ngrok/atlantis server in the background and then
did a sleep to ensure the processes were running or just assumed they
were up. Now, we wait for a specific output to ensure those processes
are running before continuing on with the rest of the script.

Fixes #92.
meringu pushed a commit to meringu/atlantis that referenced this issue May 29, 2023
* readme improvements

* Return plan errors back to the user

* README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants