Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCrypt::Errors::InvalidHash: invalid hash when running db:seed #66

Open
metroid2010 opened this issue Nov 1, 2020 · 3 comments
Open

Comments

@metroid2010
Copy link

On latest commit, development branch (default).

Tried
bundle install
bin/rails db:migrate
bin/rails db:seed
as per the instructions in the README.md

Got:

** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
/usr/lib/ruby/gems/2.7.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:30: warning: rb_check_safe_obj will be removed in Ruby 3.0
rake aborted!
BCrypt::Errors::InvalidHash: invalid hash
Traceback (most recent call last):
bin/rake: invalid hash (BCrypt::Errors::InvalidHash)
bin/rake: undefined method `reject' for nil:NilClass (NoMethodError)

Then, when launching the server with rails server, the page displays this error:

ActionView::Template::Error at /conferences
uninitialized constant ActionView::CompiledTemplates::ARG

I guest this last error is because it's trying to fetch conferences from db/development.sql, which has the tables created, but not populated (because db:seed failed).

Any ideas what could be the cause?

@metroid2010
Copy link
Author

metroid2010 commented Nov 1, 2020

Update: Bcrypt does not throw an error when reverting 495ed48
development.sql gets created successfully, but when running the server, errors are throw, I guess because something changed in the db format.

@Patataman
Copy link
Member

Patataman commented Nov 2, 2020

Ignorando las versiones del Gemfile.lock (aka, te cargas el gemfile.lock y le das al bundle install), actualizando Bitly a >= 2 y apañando un poco las cosas, siguiendo lo del readme para desplegar development funciona, luego no carga porque al parecer faltan cosas en bbdd, o eso creo.

Por otro lado, la versión de producción a mi tampoco me ha funcionado ya que parece que se necesita tener rvm (https://rvm.io/) y yo no lo tenía y he sido incapaz de instalarlo en debian

@Patataman
Copy link
Member

Patataman commented Nov 9, 2020

  1. Instalar RVM

Instalar RVM es un infierno: https://rvm.io/rvm/install#explained
Probablemente haya que cambiar el path del rvm_path por tu propio home con export rvm_path=$HOME/rvm para evitar problemas de sudo, conflictos y basuras de ruby

1.1 Pon en tu .bashrc la línea export rvm_path=$HOME/rvm al final, porque se va a resetear cada vez que inicies una terminal/sesión

  1. Instalar Ruby 2.7.0

Una vez instalado RVM se puede instalar ruby con rvm install 2.7.0

  1. Clonarse gul-talks
  2. Borrar el Gemfile.lock,
  3. rvm use ruby para utilizar el ruby que has instalado con rvm
  4. Seguir el README, instalando las dependencias que diga que hacen falta, como mysql o sqllite
    6.1 bundle install --without production
    6.2 Esperas medio año a que acabe
    6.3 mkdir app/assets/config && touch app/assets/config/manifest.js
    6.4 Reemplaza la versión de Bitly en el Gemfile.lock por esto y repite el paso 6.1
   bitly (1.1.0)
      httparty (>= 0.7.6)
      multi_json (~> 1.3)
      oauth2 (>= 0.5.0, < 2.0)

6.5 rake db:migrate
6.6 rake db:seed
6.7 rails server
6.8 Disfruta de este error

imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants