Skip to content

Core methods doesn't work in configuration block after upgrading Falcon to 0.44 #236

Open
@Exterm1nate

Description

@Exterm1nate

After upgrading Falcon from 0.43 to 0.44 this configuration:

# falcon.rb

load :rack

rack File.basename(__dir__) do
  endpoint do
    Async::HTTP::Endpoint.for(scheme, "0.0.0.0", port: Integer(3000), protocol: protocol)
  end
  count Integer(2)
end

breaks server boot with a very strange error:

/home/kirill/gems/ruby-3.3.0/gems/async-service-0.12.0/lib/async/service/environment.rb:124:in `block (2 levels) in wrap': wrong number of arguments (given 1, expected 0) (ArgumentError)
	from /home/kirill/Desktop/my_project/falcon.rb:7:in `block (2 levels) in load_file'
	from /home/kirill/gems/ruby-3.3.0/gems/async-service-0.12.0/lib/async/service/environment.rb:125:in `block (2 levels) in wrap'
	from /home/kirill/gems/ruby-3.3.0/gems/falcon-0.45.2/lib/falcon/service/server.rb:38:in `start'
	from /home/kirill/gems/ruby-3.3.0/gems/async-service-0.12.0/lib/async/service/controller.rb:48:in `block in start'
	from /home/kirill/gems/ruby-3.3.0/gems/async-service-0.12.0/lib/async/service/controller.rb:47:in `each'
	from /home/kirill/gems/ruby-3.3.0/gems/async-service-0.12.0/lib/async/service/controller.rb:47:in `start'
	from /home/kirill/gems/ruby-3.3.0/gems/async-container-0.18.0/lib/async/container/controller.rb:203:in `run'
	from /home/kirill/gems/ruby-3.3.0/gems/async-service-0.12.0/lib/async/service/controller.rb:32:in `run'
	from /home/kirill/gems/ruby-3.3.0/gems/falcon-0.45.2/lib/falcon/command/host.rb:41:in `call'
	from /home/kirill/gems/ruby-3.3.0/gems/samovar-2.3.0/lib/samovar/command.rb:21:in `call'
	from /home/kirill/gems/ruby-3.3.0/gems/falcon-0.45.2/bin/falcon-host:26:in `<top (required)>'
	from bin/falcon-host:27:in `load'
	from bin/falcon-host:27:in `<main>'

After some investigation I found that configuration block rack {} doesn't support Ruby core methods anymore, e.g. puts, Integer(), etc.

Changing count Integer(2) to count 2 fixes the server boot and works well.

Also it is rather strange that block endpoint {} inside rack {} do support all these methods, that are breaking the rack {} itself. For example, you can use Integer() inside.

# falcon.rb

load :rack

rack File.basename(__dir__) do
  endpoint do
    Async::HTTP::Endpoint.for(scheme, "0.0.0.0", port: Integer(3000), protocol: protocol)
  end
  count 2
end

I suppose this should be fixed or at least mentioned in docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions