{"action":"created","issue":{"url":"https://api.github.com/repos/rack/rack/issues/842","repository_url":"https://api.github.com/repos/rack/rack","labels_url":"https://api.github.com/repos/rack/rack/issues/842/labels{/name}","comments_url":"https://api.github.com/repos/rack/rack/issues/842/comments","events_url":"https://api.github.com/repos/rack/rack/issues/842/events","html_url":"https://github.com/rack/rack/issues/842","id":68797962,"number":842,"title":"Rack::Lint::LintError: env missing required key SERVER_NAME","user":{"login":"earlonrails","id":666467,"avatar_url":"https://avatars.githubusercontent.com/u/666467?v=3","gravatar_id":"","url":"https://api.github.com/users/earlonrails","html_url":"https://github.com/earlonrails","followers_url":"https://api.github.com/users/earlonrails/followers","following_url":"https://api.github.com/users/earlonrails/following{/other_user}","gists_url":"https://api.github.com/users/earlonrails/gists{/gist_id}","starred_url":"https://api.github.com/users/earlonrails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earlonrails/subscriptions","organizations_url":"https://api.github.com/users/earlonrails/orgs","repos_url":"https://api.github.com/users/earlonrails/repos","events_url":"https://api.github.com/users/earlonrails/events{/privacy}","received_events_url":"https://api.github.com/users/earlonrails/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rack/rack/labels/Needs%20Feedback","name":"Needs Feedback","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-04-15T22:10:31Z","updated_at":"2016-09-09T12:15:15Z","closed_at":"2015-07-08T17:01:05Z","body":"There a few posts about this on the web. There isn't much information about setting the SERVER_NAME. Not on rack wiki, or sinatra or webrick or puma. If this is a required header then how to fix would be great.\r\n```\r\n$ rackup --port 4000\r\n[2015-04-15 10:21:31] INFO  WEBrick 1.3.1\r\n[2015-04-15 10:21:31] INFO  ruby 1.9.3 (2015-01-29) [java]\r\n[2015-04-15 10:21:31] INFO  WEBrick::HTTPServer#start: pid=21255 port=4000\r\n^[[1;5ARack::Lint::LintError: env missing required key SERVER_NAME\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/lint.rb:20:in `assert'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/lint.rb:259:in `check_env'\r\n  org/jruby/RubyArray.java:1613:in `each'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/lint.rb:255:in `check_env'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/lint.rb:43:in `_call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/lint.rb:37:in `call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/showexceptions.rb:24:in `call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/commonlogger.rb:33:in `call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/chunked.rb:54:in `call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/content_length.rb:15:in `call'\r\n  /usr/local/rvm/gems/jruby-1.7.19/gems/rack-1.6.0/lib/rack/handler/webrick.rb:89:in `service'\r\n  /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/webrick/httpserver.rb:138:in `service'\r\n  /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/webrick/httpserver.rb:94:in `run'\r\n  /usr/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/webrick/server.rb:191:in `start_thread'\r\n127.0.0.1 - - [15/Apr/2015:10:22:04 -0700] \"GET /somepath HTTP/1.1\" 500 44080 0.4410\r\n```\r\n\r\nHowever this is only part of the issue. This is of course in development mode since I have not put any options on my rackup command, but here take a look at what happens when I do add these parameters. This is also using puma this time since I am going crazy trying to figure this out\r\n\r\nI edited this a bit just to not show anything company related, just paths and such.\r\n```\r\nrackup --port 4000 --env production\r\nPuma 2.11.2 starting...\r\n* Min threads: 0, max threads: 16\r\n* Environment: production\r\n* Listening on tcp://localhost:4000\r\nI, [2015-04-15T13:30:09.559000 #22412]  INFO -- : auth_token ####DELETED####\r\nI, [2015-04-15T13:30:10.290000 #22412]  INFO -- : got token ####DELETED####\r\n127.0.0.1 - - [15/Apr/2015:13:30:10 -0700] \"GET /somepath HTTP/1.0\" 200 196 0.8590\r\n2015-04-15 13:30:10 -0700: Read error: #<NoMethodError: undefined method `to_java_bytes' for :SERVER_NAME:Symbol>\r\npuma-2.11.2-java/lib/puma/java_io_buffer.rb:23:in `<<'\r\npuma-2.11.2-java/lib/puma/java_io_buffer.rb:28:in `append'\r\norg/jruby/RubyArray.java:1613:in `each'\r\npuma-2.11.2-java/lib/puma/java_io_buffer.rb:28:in `append'\r\npuma-2.11.2-java/lib/puma/server.rb:591:in `handle_request'\r\norg/jruby/RubyArray.java:1613:in `each'\r\npuma-2.11.2-java/lib/puma/server.rb:590:in `handle_request'\r\nrack-1.6.0/lib/rack/utils.rb:482:in `each'\r\norg/jruby/RubyHash.java:1341:in `each'\r\nrack-1.6.0/lib/rack/utils.rb:481:in `each'\r\npuma-2.11.2-java/lib/puma/server.rb:576:in `handle_request'\r\npuma-2.11.2-java/lib/puma/server.rb:375:in `process_client'\r\npuma-2.11.2-java/lib/puma/server.rb:262:in `run'\r\norg/jruby/RubyProc.java:271:in `call'\r\npuma-2.11.2-java/lib/puma/thread_pool.rb:104:in `spawn_thread'\r\n```\r\nHere the environment says production and it is using the database.yml production settings, but the lint is still happening. The final solution is to use `RACK_ENV=production rackup --port 4000` which will not show these lint errors or throw a 500. \r\n\r\nThis is very odd because https://github.com/rack/rack/blob/master/lib/rack/server.rb#L334 sets the ENV['RACK_ENV'] to the option that you pass to the rackup command! Am I missing something here? What is going on? Just wanted to save some people the headache I had with this."},"comment":{"url":"https://api.github.com/repos/rack/rack/issues/comments/245896430","html_url":"https://github.com/rack/rack/issues/842#issuecomment-245896430","issue_url":"https://api.github.com/repos/rack/rack/issues/842","id":245896430,"user":{"login":"aisrael","id":89215,"avatar_url":"https://avatars.githubusercontent.com/u/89215?v=3","gravatar_id":"","url":"https://api.github.com/users/aisrael","html_url":"https://github.com/aisrael","followers_url":"https://api.github.com/users/aisrael/followers","following_url":"https://api.github.com/users/aisrael/following{/other_user}","gists_url":"https://api.github.com/users/aisrael/gists{/gist_id}","starred_url":"https://api.github.com/users/aisrael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aisrael/subscriptions","organizations_url":"https://api.github.com/users/aisrael/orgs","repos_url":"https://api.github.com/users/aisrael/repos","events_url":"https://api.github.com/users/aisrael/events{/privacy}","received_events_url":"https://api.github.com/users/aisrael/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T12:15:15Z","updated_at":"2016-09-09T12:15:15Z","body":"Am encountering running under Docker. Now sure if I should open a new issue, but the gist of it is:\r\n\r\n- Rack + Sinatra app running in a docker container, started using `rackup --host 0.0.0.0`, let's call the container `sinatra`. This was launched using `docker run -p 9292:9292 sinatra ...`\r\n- Another app (`rails`) started in another docker container, linked to the above using `docker run --link sinatra ...`\r\n\r\nFrom the host (OS X), I can `curl localhost:9292` succesfully.\r\n\r\nFrom the `rails` container, if I try `curl sinatra:9292` I get the `Rack::Lint::LintError: env missing required key SERVER_NAME`."}}
{"actor":{"display_login":"aisrael"}}