Can't deploy Play application into Heroku - deployment

I'm having issues deploying a Play application into Heroku. I've had no problems deploying other basic applications without modules, but this one is giving me the following error:
#ubuntu:~/$ git push heroku master
Counting objects: 812, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (699/699), done.
Writing objects: 100% (794/794), 2.00 MiB, done.
Total 794 (delta 145), reused 0 (delta 0)
-----> Heroku receiving push
-----> Play! app detected
-----> Installing ivysettings.xml..... done
-----> Building Play! application...
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.3, http://www.playframework.org
~
1.2.3
Play! application root found at ./mods/playcopy/crud-1.2.3/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/use-gs-in-tags/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/demo/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/inline-dependency-declaring/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/jquery-ui/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/booking/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/less-and-coffee/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/chat/
./mods/playcopy/greenscript-1.2.6h/
./
Resolving dependencies: .play/play dependencies ./mods/playcopy/crud-1.2.3/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/use-gs-in-tags/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/demo/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/inline-dependency-declaring/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/jquery-ui/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/booking/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/less-and-coffee/
./mods/playcopy/greenscript-1.2.6h/samples-and-tests/chat/
./mods/playcopy/greenscript-1.2.6h/
./ --forceCopy --silent -Duser.home=/tmp/build_1hn7e8ahaqrso 2>&1
~ Resolving dependencies using /tmp/build_1hn7e8ahaqrso/mods/playcopy/crud-1.2.3/conf/dependencies.yml,
~
~
~ No dependencies to install
~
~ Done!
~
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.3, http://www.playframework.org
~
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 64: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/use-gs-in-tags/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 65: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/demo/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 66: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/inline-dependency-declaring/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 67: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/jquery-ui/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 68: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/booking/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 69: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/less-and-coffee/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 70: ./mods/playcopy/greenscript-1.2.6h/samples-and-tests/chat/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 71: ./mods/playcopy/greenscript-1.2.6h/: is a directory
/app/slug-compiler/lib/../language_packs/play/bin/compile: line 72: ./: is a directory
! Failed to build Play! application
! Cleared Play! framework from cache
/app/slug-compiler/lib/language_pack.rb:35:in `block in compile': failed to compile Play! app (Slug::CompileError)
from /app/slug-compiler/lib/language_pack.rb:32:in `fork'
from /app/slug-compiler/lib/language_pack.rb:32:in `compile'
from /app/slug-compiler/lib/slug.rb:490:in `block in run_language_pack'
from /app/slug-compiler/lib/utils.rb:117:in `log'
from /app/slug-compiler/lib/slug.rb:727:in `log'
from /app/slug-compiler/lib/slug.rb:489:in `run_language_pack'
from /app/slug-compiler/lib/slug.rb:110:in `block (2 levels) in compile'
from /app/slug-compiler/lib/utils.rb:98:in `block in timeout'
from /usr/local/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
from /app/slug-compiler/lib/utils.rb:98:in `rescue in timeout'
from /app/slug-compiler/lib/utils.rb:93:in `timeout'
from /app/slug-compiler/lib/slug.rb:99:in `block in compile'
from /app/slug-compiler/lib/utils.rb:117:in `log'
from /app/slug-compiler/lib/slug.rb:727:in `log'
from /app/slug-compiler/lib/slug.rb:98:in `compile'
from /app/slug-compiler/bin/slugc:85:in `block in <main>'
from /app/slug-compiler/lib/slug.rb:498:in `block in lock'
from /app/slug-compiler/lib/repo_lock.rb:44:in `call'
from /app/slug-compiler/lib/repo_lock.rb:44:in `run'
from /app/slug-compiler/lib/slug.rb:498:in `lock'
from /app/slug-compiler/bin/slugc:66:in `<main>'
-----> Discovering process types
Procfile declares types -> web
-----> Compiled slug size is 36.4MB
-----> Launching... done, v6
http://billeteo.herokuapp.com deployed to Heroku
To git#heroku.com:billeteo.git
53b789c..24f66a4 master -> master
Although I'm running from the root of my project, Heroku believes that my root is at:
Play! application root found at ./mods/playcopy/crud-1.2.3/
which, of course, doesn't contain the code and the process fails.
My application is standard Play app with the following dependencies.xml:
# Application dependencies
# Notes:
# play is an alias for play -> play $currentVersion
# play -> crud is an alias for play -> crud $currentVersion
# play -> secure is an alias for play -> secure $currentVersion
# Modules from the main repository use 'play' as organisation
require:
- play
- playcopy -> crud 1.2.3
- playcopy -> betterlogs 1.0
- playcopy -> cobertura 2.1
- playcopy -> mockito 0.1
- playcopy -> greenscript 1.2.6h
- custom -> useragentcheck 1.0
- org.hibernate -> hibernate-search 3.4.0.Final
repositories:
- localModules:
type: local
artifact: "${application.path}/mods/[organisation]/[module]-[revision]"
contains:
- playcopy
- custom
I'm using a local repository for some official Play modules as they may have some custom code (remove some unnecessary classes, change security, some logs, etc).
Anyone knows how to make Heroku find the right root? Could not find anything on Google...

The Play setup on Heroku didn't anticipate your particular setup here. Like you indicated, it's confused about where the root of your application is. I think we can push a fix to resolve this, but in the mean time, you should be able to work around it. Try this:
Zip your custom modules and change your dependencies.yml file to
...
repositories:
- localModules:
type: local
artifact: "${application.path}/mods/[organisation]/[module]-[revision].zip"
contains:
- playcopy
- custom
...
During dependency resolution, Play should unzip your custom modules and put them in the right place. Also, Heroku shouldn't get confused about where the root of your app is.

Related

Checkov upgrade notice causing CI to fail

Beginning around 11:30am ET on 11/21/2022, our CI pipelines started failing due to a Checkov update/upgrade notice with an input prompt (see output below).
Is there command line option to skip this check from bridgecrew?
$ checkov
_ _
___| |__ ___ ___| | _______ __
/ __| '_ \ / _ \/ __| |/ / _ \ \ / /
| (__| | | | __/ (__| < (_) \ V /
\___|_| |_|\___|\___|_|\_\___/ \_/
By bridgecrew.io | version: 2.1.244
Update available 2.1.244 -> 2.2.80
Run pip3 install -U checkov to update
Would you like to “level up” your Checkov powers for free? The upgrade includes:
• Command line docker Image scanning
• Software Composition Analysis
• Centralized policy management
• Free bridgecrew.cloud account with API access
• Auto-fix remediation suggestions
• Enabling of VS Code Plugin
• Dashboard visualisation of Checkov scans
• Integration with GitHub for:
◦ Automated Pull Request scanning
◦ Auto remediation PR generation
• Integration with up to 100 cloud resources for:
◦ Automated cloud resource checks
◦ Resource drift detection
and much more...
It's easy and only takes 2 minutes. We can do it right now!
To Level-up, press 'y'...
Level up? (y/n): Traceback (most recent call last):
File "/usr/bin/checkov", line 9, in <module>
sys.exit(run())
File "/usr/lib/python3.10/site-packages/checkov/main.py", line 368, in run
bc_integration.onboarding()
File "/usr/lib/python3.10/site-packages/checkov/common/bridgecrew/platform_integration.py", line 696, in onboarding
reply = self._input_levelup_results()
File "/usr/lib/python3.10/site-packages/checkov/common/bridgecrew/platform_integration.py", line 860, in _input_levelup_results
result = str(input('Level up? (y/n): ')).lower().strip() # nosec
EOFError: EOF when reading a line
Uploading artifacts for failed job
00:01
Uploading artifacts...
WARNING: plan.json: no matching files
ERROR: No files to upload
I did try to update the version using pip but the old version is still being used. This is a separate issue, and at this point my focus is on avoiding the update check entirely.
bash-5.1# checkov --version
2.1.244
bash-5.1# pip3 install -U checkov
... (Lots of output)
bash-5.1# checkov --version
2.1.244
This is my .checkov.yaml file:
compact: true
quiet: true
skip-download: false
download-external-modules: true
directory:
- ./
skip-check:
- CKV_AWS_18
- CKV_AWS_50
- CKV_AWS_115
- CKV_AWS_116
- CKV_AWS_117
- CKV_AWS_158
- CKV_AWS_173
- CKV_OPENAPI_4 # some APIs are public
- CKV_OPENAPI_5 # some APIs are public
- LOW
You're only getting this output because you're calling checkov without any command line parameters. It's been like this for about a year maybe even more.
If anyone else runs into this, I fixed it by explicitly passing the config-file flag on the command line:
checkov --config-file .checkov.yaml
It's still unclear to me why the pipelines started failing when we were using a pre-build Docker image to run our jobs.
I did try to update the version using pip but the old version is still being used
Version 2.1.244 was released on Oct 2nd, so it isn't from today. I join James' suggestion to use parameters - it will avoid this prompt altogether. And also to check what is missing in your machine's deps as it seems the latest checkov cannot be installed. Highly recommend using checkov's docker directly if you're not in the mood to debug this, too!

undefined local variable or method `owner' for FastlaneCore::Helper::AppcenterHelper:Class (NameError)

while I am trying to distribute the iOS app to appcenter Using Fastlane I am getting error like [!] undefined local variable or method `owner' for FastlaneCore::Helper::AppcenterHelper:Class (NameError).
+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 💥 | appcenter_upload | 1 |
+------+------------------+-------------+
[11:49:06]: fastlane finished with errors
Looking for related GitHub issues on fastlane/fastlane...
➡️ appcenter upload error
https://github.com/fastlane/fastlane/issues/14907 [closed] 1 💬
5 days ago
🔗 You can ⌘ + double-click on links to open them directly in your browser.
/Users/capgemini/.gem/gems/fastlane-plugin-appcenter-1.0.1/lib/fastlane/plugin/appcenter/helper/appcenter_helper.rb:373:in get_app': [!] undefined local variable or methodowner' for FastlaneCore::Helper::AppcenterHelper:Class (NameError)
from /Users/capgemini/.gem/gems/fastlane-plugin-appcenter-1.0.1/lib/fastlane/plugin/appcenter/actions/appcenter_upload_action.rb:173:in get_or_create_app'
from /Users/capgemini/.gem/gems/fastlane-plugin-appcenter-1.0.1/lib/fastlane/plugin/appcenter/actions/appcenter_upload_action.rb:201:inrun'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:256:in block (2 levels) in execute_action'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/actions/actions_helper.rb:50:inexecute_action'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:235:in block in execute_action'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:227:inchdir'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:227:in execute_action'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:157:intrigger_action_by_name'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/fast_file.rb:154:in method_missing'
from Fastfile:51:inblock in parsing_binding'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/lane.rb:33:in call'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:49:inblock in execute'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:45:in chdir'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/runner.rb:45:inexecute'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/lane_manager.rb:56:in cruise_lane'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/command_line_handler.rb:36:inhandle'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/commands_generator.rb:108:in block (2 levels) in run'
from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:incall'
from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in run'
from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:inrun_active_command'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in run!'
from /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:inrun!'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/commands_generator.rb:333:in run'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/commands_generator.rb:41:instart'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in take_off'
from /Users/capgemini/.gem/gems/fastlane-2.125.2/bin/fastlane:23:in'
from /Users/capgemini/.gem/bin/fastlane:22:in load'
from /Users/capgemini/.gem/bin/fastlane:22:in'
Take a look at the following link.
There is a error in the source code which hides the correct error. I also experienced that I got:
[!] undefined local variable or methodowner' for FastlaneCore::Helper::AppcenterHelper:Class (NameError)
No matter what I changed. My "real" error was that the app_name (and owner_name has hard to figured out) was wrong. This post helped me. Hopefully it can help you solve the real problem.

rails-api not allowing any generation

I'm struggling trying to get the configuration of rails-api with the mongo_mapper gem.
I'm using rails v 4.1.1
gemfile looks as follows
source 'https://rubygems.org'
gem 'mongo'
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
gem 'bson_ext'
gem 'railties'
I ran rails-api new test-app --skip-active-record which generates a simple file structure.
.
├── Gemfile
├── Gemfile.lock
├── README.rdoc
├── Rakefile
└── config.ru
After that, per the instructions on the README for mongo_mapper I specified the correct version in my gemfile so that it's compatible with Rails 4.
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
According to
- http://mongomapper.com/documentation/getting-started/rails.html
- How can I get mongo mapper to generate the config/mongo.yml file in Rails 4
I should then be able to run bundle exec rails generate mongo_mapper:config. It was here I started running into issues.
I first realized I need railsties gem since it wasn't even letting me run rails generate.
$ bundle exec rails generate mongo_mapper:config
/Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.6.1/lib/bundler/rubygems_integration.rb:248:in `block in replace_gem': railties is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails:22:in `<main>'
After adding that gem it allowed me to run bundle exec rails generate mongo_mapper:config but doesn't actually have access to that mongo generator. The output from the command is the standard rails help info including usage, options etc.
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/colinhhart/.rbenv/versions/2.1.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
What I've tried so far
I've tried building out what the generator is supposed to build as is described in this guide
http://technicaldebt.com/getting-started-with-ruby/mongomapper-ith-rails-quickstart/
But then realized that even if I build that out there's obviously still some "glue" that I'm missing, which ties everything together. I built it out just in case and of course it still didn't work.
I've made sure to bundle and and reload the terminal appropriately.
Like I said, I'm pretty sure there's something necessary that gets skipped when I build the rails-api without active record.
Any thoughts on this? Would greatly appreciate the help.
For what it's worth this is the full output when I ran rails-api new my_app --skip-active-record.
$ rails-api new pitfworld_wide_atrocities_db --skip-active-record
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
(erb):19:in `template': undefined method `name' for []:Array (NoMethodError)
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:116:in `block in template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:25:in `create_file'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:115:in `template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:17:in `template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:45:in `gemfile'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/app_base.rb:133:in `build'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:176:in `create_root_files'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/application.rb:17:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/cli.rb:14:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rails-api-0.2.1/bin/rails-api:4:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails-api:23:in `load'
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails-api:23:in `<main>'
Solution
I came across that rails-api issue right as I was writing this post and it turned out that that was the issue, after banging my head forever thinking it was a mongo issue.
The issue has been fixed and closed but hasn't yet been released and will probably be released in rails-api v0.2.2.
Ultimately, I decided to just go into the rails-api source code and apply the changes locally.

Rails app with mongoid ... (Mongoid::Errors::NoSessionConfig): No configuration could be found for a session named 'default'

With reference to https://github.com/mongoid/mongoid/issues/2894#issuecomment-14903927
I've done all the necessary changes ... still the issue is there ...
spec_helper.rb file
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", FILE)
require 'rspec/rails'
require 'rspec/autorun'
require 'rails/mongoid'
Gemfile
gem 'rails', '4.0.0'
gem 'rspec-rails', '~>2.14.0'
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
gem 'bson_ext'
mongoid.yml
development:
sessions:
default:
database: mongo_demo_development
hosts:
- localhost:27017
options:
options:
test:
sessions:
default:
database: mongo_demo_test
hosts:
- localhost:27017
options:
consistency: :strong
max_retries: 1
retry_interval: 0
Following is the Error Log which is generated when I run my rails server with $rails s ...
/home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions/factory.rb:27:in create': (Mongoid::Errors::NoSessionConfig)
Problem:
No configuration could be found for a session named 'default'.
Summary:
When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
Resolution:
Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:137:inwith_name'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:390:in __session__'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:227:inmongo_session'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:171:in collection'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual/mongo.rb:265:ininitialize'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:51:in new'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:51:increate_context'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:34:in context'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:18:inlast'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/findable.rb:130:in last'
from /home/nikunj/Practice/mongo_demo/app/rules/myrule_book.rb:5:inclass:Myrule_Book'
from /home/nikunj/Practice/mongo_demo/app/rules/myrule_book.rb:3:in <top (required)>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:inload'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in block in load_file'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:innew_constants_in'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:422:in load_file'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:323:inrequire_or_load'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:462:in load_missing_constant'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:183:inconst_missing'
from /home/nikunj/Practice/mongo_demo/config/environments/development.rb:30:in block in <top (required)>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:24:inclass_eval'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:24:in configure'
from /home/nikunj/Practice/mongo_demo/config/environments/development.rb:1:in'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in require'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inblock in require'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in load_dependency'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inrequire'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/engine.rb:591:in block (2 levels) in <class:Engine>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/engine.rb:590:ineach'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/engine.rb:590:in block in <class:Engine>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:30:ininstance_exec'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:30:in run'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:55:inblock in run_initializers'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:150:in block in tsort_each'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:183:inblock (2 levels) in each_strongly_connected_component'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:210:in block (2 levels) in each_strongly_connected_component_from'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:219:ineach_strongly_connected_component_from'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:209:in block in each_strongly_connected_component_from'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:44:ineach'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:44:in tsort_each_child'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:203:ineach_strongly_connected_component_from'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:182:in block in each_strongly_connected_component'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:180:ineach'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:180:in each_strongly_connected_component'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:148:intsort_each'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:54:in run_initializers'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/application.rb:215:ininitialize!'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in method_missing'
from /home/nikunj/Practice/mongo_demo/config/environment.rb:5:in'
from /home/nikunj/Practice/mongo_demo/config.ru:3:in require'
from /home/nikunj/Practice/mongo_demo/config.ru:3:inblock in '
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:55:in instance_eval'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:55:ininitialize'
from /home/nikunj/Practice/mongo_demo/config.ru:in new'
from /home/nikunj/Practice/mongo_demo/config.ru:in'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:49:in eval'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:49:innew_from_string'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:40:in parse_file'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/server.rb:277:inbuild_app_and_options_from_config'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/server.rb:199:in app'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands/server.rb:48:inapp'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/server.rb:314:in wrapped_app'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands/server.rb:75:instart'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands.rb:78:in block in <top (required)>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands.rb:73:intap'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands.rb:73:in <top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in `'
Your mongoid.yml has an error "hosts:" key should be inside of "default:" because it is a required configuration for sessions
Please check http://mongoid.org/en/mongoid/docs/installation.html#configuration
I had the same issue and error message - In my case it was caused because the yml config file wasn't loaded. I added the following line
Mongoid.load!('config/mongoid.yml')
to config/application.rb and it solved the problem
may be The problem is in the gem file, you did't mention the version of mongoid gem. in gem file change gem "mongoid" to gem "mongoid" , '~> 4.0.2' and run bundle install restart server and console.

Application Error in heroku (using play framework)

I'm using play-1.2.4 framework in java and using MongoDB database. Pushing the project in heroku repositary successfully.
And try to open my page, I still see an Error: Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
When i enter this heroku logs command, getting the following error
heroku logs
2012-05-05T06:00:13+00:00 app[web.1]: ~ _ _
2012-05-05T06:00:13+00:00 app[web.1]: ~ _ __ | | __ _ _ _| |
2012-05-05T06:00:13+00:00 app[web.1]: ~ | __/|_|\____|\__ (_)
2012-05-05T06:00:13+00:00 app[web.1]: ~ | '_ \| |/ _' | || |_|
2012-05-05T06:00:13+00:00 app[web.1]: ~ |_| |__/
2012-05-05T06:00:13+00:00 app[web.1]: ~
2012-05-05T06:00:13+00:00 app[web.1]: ~ play! 1.2.4, http://www.p
layframework.org
2012-05-05T06:00:13+00:00 app[web.1]: ~ framework ID is prod
2012-05-05T06:00:13+00:00 app[web.1]: ~ Ctrl+C to stop
2012-05-05T06:00:13+00:00 app[web.1]: ~
2012-05-05T06:00:13+00:00 app[web.1]: ~
2012-05-05T06:00:13+00:00 app[web.1]:
2012-05-05T06:00:14+00:00 heroku[web.1]: Process exited with stat
us 0
2012-05-05T06:00:14+00:00 heroku[web.1]: State changed from start
ing to crashed
2012-05-05T06:05:17+00:00 heroku[run.1]: State changed from creat
ed to starting
2012-05-05T06:05:19+00:00 app[run.1]: Awaiting client
2012-05-05T06:05:20+00:00 heroku[run.1]: State changed from start
ing to up
2012-05-05T06:05:49+00:00 app[run.1]: Error R13 (Attach error) ->
Failed to attach to process
2012-05-05T06:05:50+00:00 heroku[run.1]: Process exited with stat
us 1
2012-05-05T06:05:50+00:00 heroku[run.1]: State changed from up to
complete
When i run heroku process using heroku ps, it shows me that
Process State Command
------- -------------- ------------------------------------
web.1 crashed for 5m play run --http.port=$PORT $PLAY_O..
When i run heroku run console, it shows me an following error:
Running console attached to terminal...
C:/Program Files/Heroku/l ib/heroku/client/rendezvous.rb:33:in `initialize': A connection a ttempt failed because the connected party did not properly respon d after a period of time, or established connection failed becaus e connected host has failed to respond. - connect(2) (Errno::ETIM EDOUT)
from C:/Program Files/Heroku/lib/heroku/client/rendezvous .rb:33:in `open'
from C:/Program Files/Heroku/lib/heroku/client/rendezvous .rb:33:in `block in start'
from C:/Program Files/ruby-1.9.3/lib/ruby/1.9.1/timeout.r b:58:in `timeout'
from C:/Program Files/Heroku/lib/heroku/client/rendezvous .rb:27:in `start'
from C:/Program Files/Heroku/lib/heroku/command/run.rb:35 :in `index'
from C:/Program Files/Heroku/lib/heroku/command.rb:148:in `run'
from C:/Program Files/Heroku/lib/heroku/cli.rb:9:in `star t'
from C:/Program Files/Heroku/bin/heroku:28:in `<main>'
What i missed here? Can anyone help me to sort this out.
You need to run Play in %prod mode on Heroku. Make sure you have --%prod in your Procfile. Here is a sample Procfile:
web: play run -Xmx256M --%prod --http.port=$PORT -Dprecompiled=true