Skip to content

Bug reading environment variable VITE_RUBY_DEV_SERVER_CONNECT_TIMEOUT #591

@chuchiperriman

Description

@chuchiperriman

When check if dev server is running, you are setting config.dev_server_connect_timeout.

When you configure VITE_RUBY_DEV_SERVER_CONNECT_TIMEOUT=1 the value "1" is a string and Socket.tcp fails.

We found this problem configuring vite_rails in a docker-compose

def dev_server_running?
    return false unless run_proxy?
    return @running if defined?(@running) && Time.now - @running_checked_at < 1

    begin
      Socket.tcp(config.host, config.port, connect_timeout: config.dev_server_connect_timeout).close
      @running = true
    rescue
      @running = false
    ensure
      @running_checked_at = Time.now
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions