Comments (8)
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.
#=> 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.
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.
@aliismayilov, it's related to heroku/rails_serve_static_assets#11.
from rack-cors.
The error does not happen anymore, repo owner can safely close it.
from rack-cors.
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.
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.
Also have this error in 2022, but only in GitHub CI.
Locally it works well.
from rack-cors.
Related Issues (20)
- Tag for v2.0.0 is missing HOT 3
- Does not work with Rack 3.0.0 HOT 1
- My CORS setup blocks bad urls but not POSTMAN requests HOT 3
- Vulnerabilities in included mocha.js HOT 1
- Stripe api with Cloud9 setup
- Is there any CI? HOT 1
- Cookie session related middleware interferes HOT 3
- Remove/Replace Rack::Utils::HeaderHash HOT 7
- delete the confusing `2.0.0` tag since `v2.0.0` exists? HOT 1
- issue comeback duplicate headers because of header name case HOT 3
- Release version 2.0.1 HOT 2
- How to add Access-Control-Allow-Private-Network header in Option response?
- Why is Rails.application.config.hosts required? HOT 1
- Regex origin woes HOT 2
- Upgrade to rails 7.1.1
- Ressource with $ are not handled as expected
- Access-Control-Allow-Origin is returned only if correct Origin header is available
- Documentation for the frame-ancestors directive?
- [SECURITY] CVE-2024-27456 - Insecure File Permissions in rack-cors v2.0.1 HOT 15
- The browser does not store the cookies session
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rack-cors.