Giter Site home page Giter Site logo

Comments (8)

AlexCppns avatar AlexCppns commented on July 23, 2024 5

I am getting the exact same error:
/var/lib/gems/2.4.0/gems/rack-cors-0.4.1/lib/rack/cors.rb:264:in `quote': no implicit conversion of nil into String (TypeError)

What s the fix?

from rack-cors.

aliismayilov avatar aliismayilov commented on July 23, 2024
#=> config/application.rb:35
...
    config.middleware.insert_before 0, "Rack::Cors" do
      allow do
        origins 'http://example.com/'
        resource '*', headers: :any, methods: %i(get post put delete)
      end
    end
...

from rack-cors.

cyu avatar cyu commented on July 23, 2024

The deprecation warning isn't coming from Rack::Cors.

Are you sure this is the right application.rb? It looks correct, but I have no idea how this could cause the error you're getting.

from rack-cors.

cirdes avatar cirdes commented on July 23, 2024

@aliismayilov, it's related to heroku/rails_serve_static_assets#11.

from rack-cors.

aliismayilov avatar aliismayilov commented on July 23, 2024

The error does not happen anymore, repo owner can safely close it.

from rack-cors.

JuanitoFatas avatar JuanitoFatas commented on July 23, 2024

I am seeing an similar issue:

rake aborted!
TypeError: no implicit conversion of nil into String
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:256:in `quote'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:256:in `block in origins'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:250:in `collect'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:250:in `origins'
/home/ubuntu/railsapp/config/application.rb:59:in `block (2 levels) in <class:Application>'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:44:in `instance_eval'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:44:in `allow'
/home/ubuntu/railsapp/config/application.rb:58:in `block in <class:Application>'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:29:in `instance_eval'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:29:in `initialize'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/stack.rb:43:in `new'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/stack.rb:43:in `build'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/stack.rb:118:in `block in build'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/stack.rb:118:in `each'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/stack.rb:118:in `inject'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/stack.rb:118:in `build'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:502:in `app'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:34:in `block in <module:Finisher>'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/ubuntu/railsapp/config/environment.rb:5:in `<top (required)>'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:209:in `block in invoke_prerequisites'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:207:in `each'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:207:in `invoke_prerequisites'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:186:in `block in invoke_with_call_chain'
/home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/bin/rake:23:in `load'
/home/ubuntu/railsapp/vendor/bundle/ruby/2.3.0/bin/rake:23:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/bin/bundle:23:in `load'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/bin/bundle:23:in `<main>'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/bin/ruby_executable_hooks:15:in `eval'
/home/ubuntu/.rvm/gems/ruby-2.3.1@global/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:schema:load => environment

My config in config/application.rb:

# .env
# WWW_HOSTNAME=www.lvh.me:3000


# https://github.com/cyu/rack-cors
# Note that this might still not work as static files are usually served from the web server
config.middleware.insert_before ActionDispatch::Static, Rack::Cors do
  allow do
    origins ENV['WWW_HOSTNAME']
    resource '/assets/*', :headers => :any, :methods => [:head, :get, :options]
  end
end

And I have rails_serve_static_assets 0.0.5 installed already.

Any pointers? Thanks.

from rack-cors.

PickRelated avatar PickRelated commented on July 23, 2024

Same here. It's version 0.4.0 and same error in the same place.

Without passenger rails app starts perfectly fine.

UPD: I had to provide correct passenger_app_env in my nginx config. Now the error is gone.

from rack-cors.

dankild avatar dankild commented on July 23, 2024

Also have this error in 2022, but only in GitHub CI.
Locally it works well.

from rack-cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.