oldmoe / litestack

MIT License
1.02k stars 56 forks source link

Liteboard does not work alongside Rack 3 #83

Closed rossta closed 4 months ago

rossta commented 8 months ago

After creating a new Rails 7.1 application and running the liteboard executable,

bundle exec liteboard -d path/to/data

I see the following error when trying to visit the app at http://localhost:9292:

NoMethodError: undefined method `unescape' for module URI

This error is reproducible with the following dependencies:

Ruby version: 3.3.0 Rails version: 7.1.2 Rack version: 3.0.8 Litestack version: 0.4.2

With this set of dependencies, litestack installs an old version of hanami-router: 0.6.2, whereas the most recent version of hanami-router as of this writing is 2.0.x. The 0.6.x version of hanami-router is not compatible with Ruby 3, hence the error with the URI module. I believe the hanami-router 0.6.x is installed because it does not constrain the Rack version; Bundler happily picks this version to live alongside Rack 3 in my Rails application since latest version of hanami-router is constrained to Rack 2.x.

I've opened an issue with hanami-router to inquire about support for Rack 3. In the meantime, a possible fix in Litestack would be to match the rack constraint with rack ~> 2 or rack < 3.

rossta commented 8 months ago

For anyone else looking for a workaround, I'm currently downgrading to Rack 2.x in my Rails 7.1 application:

gem "rack", "~> 2.2" # litestack's liteboard depends on hanami-router which does not currently support rack 3.x as of Dec 2023

With this change, I can successfully load pages in the liteboard, either when running as an executable or when mounting on Rails routes.

oldmoe commented 4 months ago

This has been fixed in head, hanami-router is removed and liteboard now relies on the rack and rackup gems directly