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

"Proxy handler: unable to reach app" on hot-reload #656

Open
bjornkpu opened this issue Sep 25, 2024 · 0 comments
Open

"Proxy handler: unable to reach app" on hot-reload #656

bjornkpu opened this issue Sep 25, 2024 · 0 comments

Comments

@bjornkpu
Copy link

bjornkpu commented Sep 25, 2024

Problem

The runner takes ages to start the application and in the meantime the proxy is trying to reload the browser, thus hitting the error Proxy handler: unable to reach app. in the browser.

The timeings:

The go build is ~instant.
The air runner takes ~8 seconds.
The go application starts in 2.5 milli seconds.

Making me think the problem lies in the air runner.

Steps to reproduce:

  1. Start air with proxy enabled.
  2. Have the browser window on the proxy port
  3. make a change to trigger air restart
  4. se the browser display the error

Video

Here is a video of the process
https://github.com/user-attachments/assets/caac648c-1279-441d-b347-47aaf4abbc71

Expected behavior

To reload the browser after the app is up and running.

Actual Behavior

The browser reload too early, hits the error, and stops refreshing. A manual refresh is required.

Additional information

My .air.toml:

root = "."
tmp_dir = "tmp"

[build]
  args_bin = []
  bin = "tmp/main.exe"
  cmd = "go build -o ./tmp/main.exe cmd/server/main.go"
  delay = 1000
  exclude_dir = [".idea", "db", "docs", "tmp"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = true
  follow_symlink = false
  full_bin = ""
  include_dir = []
  include_ext = ["go"]
  include_file = []
  kill_delay = "0s"
  log = "build-errors.log"
  poll = false
  poll_interval = 0
  post_cmd = []
  pre_cmd = []
  rerun = false
  rerun_delay = 500
  send_interrupt = false
  stop_on_error = false

[color]
  app = ""
  build = "yellow"
  main = "magenta"
  runner = "green"
  watcher = "cyan"

[log]
  main_only = false
  time = false

[misc]
  clean_on_exit = false

[proxy]
  app_port = 8080
  enabled = true
  proxy_port = 8081

[screen]
  clear_on_rebuild = true
  keep_scroll = true

My run configuration

Screenshot 2024-09-25 093900

My system

Go version: 1.23.1
Air version: v4.12.0
GoLand version: 2024.2.2.1
Powershell version: 5.1
OS Name Microsoft Windows 11 Enterprise
OS Version: 10.0.22631 N/A Build 22631
System Manufacturer: LENOVO
System Model: 21BUS1BC00
System Type: x64-based PC
BIOS Version: LENOVO N3BET61W (1.39 ), 30.04.2024
Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 154 Stepping 3 GenuineIntel ~1711 Mhz
Total Physical Memory: 32 434 MB

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

1 participant