Rails 6 blank page when running server - ruby-on-rails

I moved to rails 6 after being developing in rails 5 and I'm getting a misterious error when running rails server. When I go to localhost://3000 the browser shows a blank page and nothing else. Did anybody have the same problem?
Important: This blank page started to show after I installed bootstrap with yarn.
PD: I'm using foreman tu run puma and compile webpacker, but happens the same with rails s command
here are the logs from the server:
10:07:50 web.1 | started with pid 11365
10:07:50 webpacker.1 | started with pid 11366
10:07:52 web.1 | Puma starting in single mode...
10:07:52 web.1 | * Version 4.3.1 (ruby 2.7.0-p0), codename: Mysterious Traveller
10:07:52 web.1 | * Min threads: 5, max threads: 5
10:07:52 web.1 | * Environment: development
10:07:57 webpacker.1 | ℹ 「wds」: Project is running at http://localhost:3035/
10:07:57 webpacker.1 | ℹ 「wds」: webpack output is served from /packs/
10:07:57 webpacker.1 | ℹ 「wds」: Content not from webpack is served from /home/enzo/Ruby/Rails/Aguara/aguara/public/packs
10:07:57 webpacker.1 | ℹ 「wds」: 404s will fallback to /index.html
10:08:06 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:06 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/static.rb:110: warning: The called method `initialize' is defined here
10:08:07 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:07 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here
10:08:08 web.1 | * Listening on tcp://0.0.0.0:5000
10:08:08 web.1 | Use Ctrl-C to stop
10:08:16 webpacker.1 | ℹ 「wdm」: Hash: c16cbbe009c350199791
10:08:16 webpacker.1 | Version: webpack 4.41.5
10:08:16 webpacker.1 | Time: 18836ms
10:08:16 webpacker.1 | Built at: 05/04/2020 10:08:16 AM
10:08:16 webpacker.1 | Asset Size Chunks Chunk Names
10:08:16 webpacker.1 | js/application-64644ee2e024eff1d7f7.js 1.72 MiB application [emitted] [immutable] application
10:08:16 webpacker.1 | js/application-64644ee2e024eff1d7f7.js.map 1.89 MiB application [emitted] [dev] application
10:08:16 webpacker.1 | js/bootstrap_custom-4a75b3f7b43b52ae2490.js 929 KiB bootstrap_custom [emitted] [immutable] bootstrap_custom
10:08:16 webpacker.1 | js/bootstrap_custom-4a75b3f7b43b52ae2490.js.map 1.04 MiB bootstrap_custom [emitted] [dev] bootstrap_custom
10:08:16 webpacker.1 | manifest.json 738 bytes [emitted]
10:08:16 webpacker.1 | ℹ 「wdm」: Compiled successfully.
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/messages/rotator.rb:28: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/messages/rotator.rb:6: warning: The called method `initialize' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionview-6.0.2.1/lib/action_view/unbound_template.rb:24: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionview-6.0.2.1/lib/action_view/template.rb:130: warning: The called method `initialize' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/translation.rb:67: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/i18n-1.7.0/lib/i18n.rb:179: warning: The called method `translate' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/abstract_controller/helpers.rb:67: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_controller/metal/request_forgery_protection.rb:313: warning: The called method `form_authenticity_token' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/railties/collection_cache_association_loading.rb:7: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/railties/collection_cache_association_loading.rb:12: warning: The called method `relation_from_options' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sprockets-4.0.0/lib/sprockets/base.rb:119: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sprockets-4.0.0/lib/sprockets/base.rb:78: warning: The called method `find_asset' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/cookies.rb:635: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:150: warning: The called method `encrypt_and_sign' is defined here
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:175: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
10:08:17 web.1 | /home/enzo/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/messages/metadata.rb:17: warning: The called method `wrap' is defined here
this is the network tab in chrome:
enter image description here

After a hard debbuging I finally have found that the yield tag was the problem, now my app is working again haha

Related

MongoDB error on Logstash start admin.listCollections | FAILED | wrong number of arguments (given 2, expected 1) [duplicate]

I'm trying to open my MongoDB models, however, I'm getting the following error:
MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s
My Mongo credentials are correct, and I can connect to the database's collections outside of Rails.
The first few lines of the error are:
Started GET "/admin/xsl_sheet" for xxx.xxx.xxx.xxx at 2020-03-03 13:49:54 UTC
Processing by RailsAdmin::MainController#index as HTML
Parameters: {"model_name"=>"xsl_sheet"}
(5.0ms) SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4
CACHE (0.1ms) SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4 [["id", "4"]]
CACHE (0.2ms) SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4 [["id", "4"]]
MONGODB | xxx.xx.x.xxx:27017 | db.saslStart | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslStart | SUCCEEDED | 0.007s
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | SUCCEEDED | 0.006s
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | SUCCEEDED | 0.006s
MONGODB | xxx.xx.x.xxx:27017 | db.find | STARTED | {"find"=>"TestCompanyNumber2_xsl_sheets", "filter"=>{"assetable_id"=>4}, "limit"=>1, "skip"=>0, "sort"=>{"_id"=>-1}, "projection"=>{"_id"=>1}}
MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s
Rendered /Project/app/views/rails_admin/main/index.html.haml within
layouts/rails_admin/application (349.7ms)
Rendered public/500.html (64.4ms)
wrong number of arguments (given 2, expected 1)
/GEMS/gems/bson-4.8.0-java/lib/bson/hash.rb:115:in `from_bson'
Edit:
Here is the code inside rails_admin.rb which (I believe) is in charge of pulling objects from MongoDB:
c.model XslSheet do
label Proc.new {"Xsl Sheet"}
navigation_label Proc.new {I18n.t('navigation.actions')}
weight 303
navigation_icon 'fa fa-file-excel-o'
list do
scopes [:applicationId]
field :data_file_name
field :updated_at
end
end
This is https://jira.mongodb.org/browse/RUBY-2146. Downgrade to bson 4.7.0 until 4.8.2 is released.
To help people answer your questions, include the versions of the software you are using (in this case, mongoid, mongo and bson versions are relevant), as well as the fact you are using JRuby.

Rails: Wrong number of arguments (given 2, expected 1) MongoID

I'm trying to open my MongoDB models, however, I'm getting the following error:
MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s
My Mongo credentials are correct, and I can connect to the database's collections outside of Rails.
The first few lines of the error are:
Started GET "/admin/xsl_sheet" for xxx.xxx.xxx.xxx at 2020-03-03 13:49:54 UTC
Processing by RailsAdmin::MainController#index as HTML
Parameters: {"model_name"=>"xsl_sheet"}
(5.0ms) SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4
CACHE (0.1ms) SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4 [["id", "4"]]
CACHE (0.2ms) SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4 [["id", "4"]]
MONGODB | xxx.xx.x.xxx:27017 | db.saslStart | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslStart | SUCCEEDED | 0.007s
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | SUCCEEDED | 0.006s
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | SUCCEEDED | 0.006s
MONGODB | xxx.xx.x.xxx:27017 | db.find | STARTED | {"find"=>"TestCompanyNumber2_xsl_sheets", "filter"=>{"assetable_id"=>4}, "limit"=>1, "skip"=>0, "sort"=>{"_id"=>-1}, "projection"=>{"_id"=>1}}
MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s
Rendered /Project/app/views/rails_admin/main/index.html.haml within
layouts/rails_admin/application (349.7ms)
Rendered public/500.html (64.4ms)
wrong number of arguments (given 2, expected 1)
/GEMS/gems/bson-4.8.0-java/lib/bson/hash.rb:115:in `from_bson'
Edit:
Here is the code inside rails_admin.rb which (I believe) is in charge of pulling objects from MongoDB:
c.model XslSheet do
label Proc.new {"Xsl Sheet"}
navigation_label Proc.new {I18n.t('navigation.actions')}
weight 303
navigation_icon 'fa fa-file-excel-o'
list do
scopes [:applicationId]
field :data_file_name
field :updated_at
end
end
This is https://jira.mongodb.org/browse/RUBY-2146. Downgrade to bson 4.7.0 until 4.8.2 is released.
To help people answer your questions, include the versions of the software you are using (in this case, mongoid, mongo and bson versions are relevant), as well as the fact you are using JRuby.

Issue with running server with React and Rails

I had to reinstall my linux VM that I code on (for school purposes) and after re forking and cloning my app, I cannot start the server. I have run the necessary steps I believe, created and migrated the database, bundle intall, and install and reinstall node_modules...I have a rake task that starts both the api and web page for me simultaneously. Now if I rake start...here is my error message...I have followed to directions on the error message to no success...not sure if I am missing something here.
rake start
10:12:38 web.1 | started with pid 3280
10:12:38 api.1 | started with pid 3281
10:12:38 web.1 |
10:12:38 web.1 | > client#0.1.0 start /home/learn/Development/Code/hoop-it-up/client
10:12:38 web.1 | > react-scripts start
10:12:38 web.1 |
10:12:39 web.1 |
10:12:39 web.1 | There might be a problem with the project dependency tree.
10:12:39 web.1 | It is likely not a bug in Create React App, but something you need to fix locally.
10:12:39 web.1 |
10:12:39 web.1 | The react-scripts package provided by Create React App requires a dependency:
10:12:39 web.1 |
10:12:39 web.1 | "babel-eslint": "10.0.1"
10:12:39 web.1 |
10:12:39 web.1 | Don't try to install it manually: your package manager does it automatically.
10:12:39 web.1 | However, a different version of babel-eslint was detected higher up in the tree:
10:12:39 web.1 |
10:12:39 web.1 | /home/learn/Development/Code/hoop-it-up/node_modules/babel-eslint (version: 10.0.3)
10:12:39 web.1 |
10:12:39 web.1 | Manually installing incompatible versions is known to cause hard-to-debug issues.
10:12:39 web.1 |
10:12:39 web.1 | If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
10:12:39 web.1 | That will permanently disable this message but you might encounter other issues.
10:12:39 web.1 |
10:12:39 web.1 | To fix the dependency tree, try following the steps below in the exact order:
10:12:39 web.1 |
10:12:39 web.1 | 1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
10:12:39 web.1 | 2. Delete node_modules in your project folder.
10:12:39 web.1 | 3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
10:12:39 web.1 | 4. Run npm install or yarn, depending on the package manager you use.
10:12:39 web.1 |
10:12:39 web.1 | In most cases, this should be enough to fix the problem.
10:12:39 web.1 | If this has not helped, there are a few other things you can try:
10:12:39 web.1 |
10:12:39 web.1 | 5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
10:12:39 web.1 | This may help because npm has known issues with package hoisting which may get resolved in future versions.
10:12:39 web.1 |
10:12:39 web.1 | 6. Check if /home/learn/Development/Code/hoop-it-up/node_modules/babel-eslint is outside your project directory.
10:12:39 web.1 | For example, you might have accidentally installed something in your home folder.
10:12:39 web.1 |
10:12:39 web.1 | 7. Try running npm ls babel-eslint in your project folder.
10:12:39 web.1 | This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.
10:12:39 web.1 |
10:12:39 web.1 | If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
10:12:39 web.1 | That would permanently disable this preflight check in case you want to proceed anyway.
10:12:39 web.1 |
10:12:39 web.1 | P.S. We know this message is long but please read the steps above :We hope you find them helpful!
10:12:39 web.1 |
10:12:39 web.1 | npm ERR! code ELIFECYCLE
10:12:39 web.1 | npm ERR! errno 1
10:12:39 web.1 | npm ERR! client#0.1.0 start: `react-scripts start`
10:12:39 web.1 | npm ERR! Exit status 1
10:12:39 web.1 | npm ERR!
10:12:39 web.1 | npm ERR! Failed at the client#0.1.0 start script.
10:12:39 web.1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:12:39 web.1 |
10:12:39 web.1 | npm ERR! A complete log of this run can be found in:
10:12:39 web.1 | npm ERR! /home/learn/.npm/_logs/2020-01-10T18_12_39_116Z-debug.log
10:12:40 web.1 | exited with code 1
10:12:40 system | sending SIGTERM to all processes
10:12:40 api.1 | terminated by SIGTERM
As requested I found two references to the babel-eslint in my package.lock.json
"babel-eslint": {
"version": "10.0.3",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.3.tgz",
"integrity": "sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA==",
"requires": {
"#babel/code-frame": "7.5.5",
"#babel/parser": "7.7.7",
"#babel/traverse": "7.7.4",
"#babel/types": "7.7.4",
"eslint-visitor-keys": "1.1.0",
"resolve": "1.12.2"
}
and also here
"react-scripts": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-3.3.0.tgz",
"integrity": "sha512-hzPc6bxCc9GnsspWqk494c2Gpd0dRbk/C8q76BNQIENi9GMwoxFljOEcZoZcpFpJgQ45alxFR6QaLt+51qie7g==",
"requires": {
"#babel/core": "7.7.4",
"#svgr/webpack": "4.3.3",
"#typescript-eslint/eslint-plugin": "2.15.0",
"#typescript-eslint/parser": "2.15.0",
"babel-eslint": "10.0.3",
etc.......
```
Okay I figured out the issue, the SKIP_PREFLIGHT_CHECK=true to a newly generated .env in my root directory did the trick, i figured since my babel-eslint version was higher than the required it should be fine to skip through and server started no issue. Thanks for the feedback to help me solve the issue!!

rails 4.2 can't see db queries in heroku logs even though log_level set to :debug

Here is a project I'm working on: https://github.com/homanchou/the_drawing_challenge
I'm having trouble seeing any db queries in the server logs on heroku or even locally in the terminal when running Puma with Foreman.
All I see are asset or web requests
21:54:34 web.1 | started with pid 54784
21:54:35 web.1 | [54784] Puma starting in cluster mode...
21:54:35 web.1 | [54784] * Version 2.10.2 (ruby 2.1.5-p273), codename: Robots on Comets
21:54:35 web.1 | [54784] * Min threads: 1, max threads: 4
21:54:35 web.1 | [54784] * Environment: development
21:54:35 web.1 | [54784] * Process workers: 2
21:54:35 web.1 | [54784] * Preloading application
21:54:36 web.1 | [54784] * Listening on tcp://0.0.0.0:5000
21:54:36 web.1 | [54784] Use Ctrl-C to stop
21:54:36 web.1 | [54784] - Worker 0 (pid: 54785) booted, phase: 0
21:54:36 web.1 | [54784] - Worker 1 (pid: 54786) booted, phase: 0
21:54:43 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:43 -0700] "GET / HTTP/1.1" 200 - 0.3120
21:54:43 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:43 -0700] "GET /logo_header.png HTTP/1.1" 304 - 0.0079
21:54:45 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:45 -0700] "GET /challenges/8 HTTP/1.1" 200 - 0.0443
21:54:45 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:45 -0700] "GET /logo_header.png HTTP/1.1" 304 - 0.0067
I had to add another line to the Procfile log: tail -f -n 0 log/development.log to see logs or errors in stdout of foreman start like I normally do, but that only works locally and not on heroku unless I want to scale up a process for that tailing.
In my other rails project I can see the db queries fine, even on heroku I can see the db queries in the log:
2015-04-03T03:46:40.052067+00:00 app[web.1]: Started GET "/api/notifications/unread_count" for 97.93.34.8 at 2015-04-03 03:46:40 +0000
2015-04-03T03:46:40.070865+00:00 app[web.1]: Merchant Load (2.7ms) SELECT "merchants".* FROM "merchants" WHERE "merchants"."id" = $1 ORDER BY "merchants"."id" ASC LIMIT 1 [["id", 7502]]
2015-04-03T03:46:40.085454+00:00 app[web.1]: SQL (2.3ms) UPDATE "merchants" SET "updated_at" = '2015-04-03 03:46:40.074442', "last_active_at" = '2015-04-03 03:46:40.074442' WHERE "merchants"."id" = $1 [["id", 7502]]
2015-04-03T03:46:40.101382+00:00 app[web.1]: (2.3ms) SELECT COUNT(*) FROM "notifications" WHERE "notifications"."merchant_id" = $1 AND "notifications"."state" = $2 [["merchant_id", 7502], ["state", "unread"]]
2015-04-03T03:46:40.058083+00:00 app[web.1]: Processing by NotificationsController#unread_count as JSON
2015-04-03T03:46:40.073916+00:00 app[web.1]: (1.0ms) BEGIN
2015-04-03T03:46:40.093737+00:00 app[web.1]: (7.4ms) COMMIT
2015-04-03T03:46:40.102858+00:00 app[web.1]: Completed 200 OK in 45ms (Views: 0.2ms | ActiveRecord: 15.6ms)
I tried comparing the two and even copying over some environment configurations but I still can't figure it out. I've tried setting config.log_level = :debug on the production environment. I can see db queries in the ruby console, but not the heroku or local puma stdout in the terminal. What am I missing?
If you need to use puma for websockets etc try adding
ActiveRecord::Base.logger.level = Logger::DEBUG
to your environments.rb or environments/production

How to resolve Rack Lint errors?

I have noticed that certain requests, particularly from Uptime Robot to test page uptime have recently started generated the following Rack Lint error on my Rails 3.1.x app:
21:47:05 web.1 | Started HEAD "/" for 74.86.158.106 at 2012-03-22 21:47:05 -0400
21:47:05 web.1 | Processing by HomeController#index as */*
...
21:47:05 web.1 | /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/activesupport-3.1.4/lib/active_support/core_ext/string/output_safety.rb:23: warning: regexp match /.../n against to UTF-8 string
...
21:47:05 web.1 | Completed 200 OK in 81ms (Views: 60.3ms | ActiveRecord: 0.0ms)
21:47:05 web.1 | 74.86.158.106 - - [22/Mar/2012 21:47:05] "GET / HTTP/1.1" 200 31842 0.1993
21:47:05 web.1 | E, [2012-03-22T21:47:05.546848 #18938] ERROR -- : app error: Content-Length header was 31842, but should be 0 (Rack::Lint::LintError)
21:47:05 web.1 | E, [2012-03-22T21:47:05.546978 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/rack-1.3.6/lib/rack/lint.rb:19:in `assert'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547079 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/rack-1.3.6/lib/rack/lint.rb:501:in `verify_content_length'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547178 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/rack-1.3.6/lib/rack/lint.rb:525:in `each'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547277 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/rack-1.3.6/lib/rack/body_proxy.rb:23:in `method_missing'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547375 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/unicorn-4.2.0/lib/unicorn/http_response.rb:41:in `http_response_write'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547476 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:538:in `process_client'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547574 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:604:in `worker_loop'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547672 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:487:in `spawn_missing_workers'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547770 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:137:in `start'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547867 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/gems/unicorn-4.2.0/bin/unicorn:121:in `<top (required)>'
21:47:05 web.1 | E, [2012-03-22T21:47:05.547966 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/bin/unicorn:19:in `load'
21:47:05 web.1 | E, [2012-03-22T21:47:05.548063 #18938] ERROR -- : /Users/username/.rvm/gems/ruby-1.9.3-p125#project/bin/unicorn:19:in `<main>'
Any ideas as to what may be going on here? I'm really not finding a solution right now that specifically addresses what to do in this scenario as far as poking and hunting down what really may be going on.
I know it's an old question, but I have the exact same issue. Requests from UptimeRobot and New Relic (and only from IPs from those two) give these log messages.
Both UptimeRobot and NewRelic reports 'OK'.
It seems that it is not the request that Rack::Lint is complaining about, but the response. Look at the stacktrace. It comes through http_response_write of unicorn (I too use unicorn).
I will investigate more and add any findings here.
UPDATE:
I am able to reproduce the issue with
$ curl https://example.com -X HEAD -i
HTTP/1.1 200 OK
Server: nginx/1.6.2 (Ubuntu)
Date: Wed, 18 Nov 2015 09:17:11 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 18422
Connection: keep-alive
Status: 200 OK
...
curl: (18) transfer closed with 18422 bytes remaining to read
So it seems that my old Rails is not supporting HEAD requests properly.
UPDATE: I am not able to reproduce on my vagrant box or on the staging server. Only difference from production I can think of is SSL.
Looks like your Uptime robot is sending a header with the wrong value. It should be sending the Content-length header with a value of 0 (or not sending it at all) but it's sending it with 31842, which is probably wrong.
You could direct it to some other http server, dump all headers and see why it is sending this or just change your uptime robot to not send this header.

Resources