Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Sinatra apps mounted inside Rails broken with v3 #31

Open
mfkp opened this issue Jun 24, 2016 · 4 comments
Open

Sinatra apps mounted inside Rails broken with v3 #31

mfkp opened this issue Jun 24, 2016 · 4 comments

Comments

@mfkp
Copy link

mfkp commented Jun 24, 2016

Hi there, me again.

As part of the upgrade process, I noticed that my "mounted apps" using Sinatra are now broken.

A common example would be Sidekiq::Web (a web interface for your sidekiq queue).

It is mounted in the routes file like:

require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'

And the error that you get when visiting that page is:

NoMethodError at /sidekiq/
undefined method `endpoint=' for nil:NilClass
file: sinatra.rb location: block in dispatch! line: 13

Here's the backtrace if it helps:
Backtrace

I assume the problem is that I'm only using the Rails initialization steps, but I'll also need to somehow include the Rack steps for these mounted Rack apps.

Any idea on how that can be done?

@mikker
Copy link
Collaborator

mikker commented Jun 24, 2016

Weird. I have that exact Sidekiq setup in two of my apps and no problem with it. I can look into this but I'm unsure when I'll have the time. Whatever you can provide to help would be great. Thanks!

@pallavsharma
Copy link

pallavsharma commented Jul 28, 2016

i'm also facing same issue

require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq_worker'

this is the error log.

NoMethodError (undefined method `endpoint=' for nil:NilClass):
  opbeat (3.0.7) lib/opbeat/injections/sinatra.rb:13:in `block in dispatch!'
  opbeat (3.0.7) lib/opbeat/injections/sinatra.rb:11:in `tap'
  opbeat (3.0.7) lib/opbeat/injections/sinatra.rb:11:in `dispatch!'
  sinatra (1.4.6) lib/sinatra/base.rb:906:in `block in call!'
  sinatra (1.4.6) lib/sinatra/base.rb:1066:in `block in invoke'
  sinatra (1.4.6) lib/sinatra/base.rb:1066:in `catch'
  sinatra (1.4.6) lib/sinatra/base.rb:1066:in `invoke'
  sinatra (1.4.6) lib/sinatra/base.rb:906:in `call!'
  sinatra (1.4.6) lib/sinatra/base.rb:894:in `call'
  rack (1.6.4) lib/rack/auth/basic.rb:25:in `call'
  rack-protection (1.5.3) lib/rack/protection/xss_header.rb:18:in `call'
  rack-protection (1.5.3) lib/rack/protection/path_traversal.rb:16:in `call'
  rack-protection (1.5.3) lib/rack/protection/json_csrf.rb:18:in `call'
  rack-protection (1.5.3) lib/rack/protection/base.rb:49:in `call'
  rack-protection (1.5.3) lib/rack/protection/base.rb:49:in `call'
  rack-protection (1.5.3) lib/rack/protection/frame_options.rb:31:in `call'
  rack (1.6.4) lib/rack/nulllogger.rb:9:in `call'
  rack (1.6.4) lib/rack/head.rb:13:in `call'
  sinatra (1.4.6) lib/sinatra/base.rb:181:in `call'
  sinatra (1.4.6) lib/sinatra/base.rb:2021:in `call'
  sinatra (1.4.6) lib/sinatra/base.rb:1486:in `block in call'
  sinatra (1.4.6) lib/sinatra/base.rb:1795:in `synchronize'
  sinatra (1.4.6) lib/sinatra/base.rb:1486:in `call'
  actionpack (4.2.3) lib/action_dispatch/routing/mapper.rb:51:in `serve'
  actionpack (4.2.3) lib/action_dispatch/journey/router.rb:43:in `block in serve'
  actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `each'
  actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `serve'
  actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:821:in `call'
  rack (1.6.4) lib/rack/etag.rb:24:in `call'
  rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
  rack (1.6.4) lib/rack/head.rb:13:in `call'
  remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/flash.rb:260:in `call'
  rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  activerecord (4.2.3) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.2.3) lib/active_support/callbacks.rb:84:in `run_callbacks'
  actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.3) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.3) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.3) lib/rails/engine.rb:518:in `call'
  railties (4.2.3) lib/rails/application.rb:165:in `call'
  unicorn (4.9.0) lib/unicorn/http_server.rb:580:in `process_client'
  unicorn (4.9.0) lib/unicorn/http_server.rb:674:in `worker_loop'
  unicorn (4.9.0) lib/unicorn/http_server.rb:529:in `spawn_missing_workers'
  unicorn (4.9.0) lib/unicorn/http_server.rb:140:in `start'
  unicorn (4.9.0) bin/unicorn:126:in `<top (required)>'
  /home/deployer/apps/xyz/current/vendor/bundle/ruby/2.2.0/bin/unicorn:23:in `load'
  /home/deployer/apps/xyz/current/vendor/bundle/ruby/2.2.0/bin/unicorn:23:in `<main>'

@mikker
Copy link
Collaborator

mikker commented Aug 25, 2016

Looks like sinatra has this fixed in master

gem 'sinatra', github: 'sinatra'
gem 'sidekiq'

Can either one of you confirm? @mfkp @pallavsharma

@mikker
Copy link
Collaborator

mikker commented Sep 28, 2016

Anybody still have this problem? Otherwise I'm closing this because I like closing stuff 😄

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

No branches or pull requests

3 participants