jbox-web / ajax-datatables-rails

A wrapper around DataTable's ajax methods that allow synchronization with server-side pagination in a Rails app
MIT License
587 stars 228 forks source link

i18n-js incompatibility on heroku #394

Closed cassioalmeidas closed 1 year ago

cassioalmeidas commented 3 years ago

this gem has an incompatibility with the i18n-js gem (according to the following setup: https://gist.github.com/bazzel/ecdff4718962e57c2d5569cf01d332fe) when first deploying to heroku, shows the following error during assets:precompile task:

...

remote:         from /tmp/build_6d6e3419/vendor/bundle/ruby/3.0.0/gems/ajax-datatables-rails-1.3.1/lib/ajax-datatables-rails/base.rb:6:in `<class:Base>'
remote:         from /tmp/build_6d6e3419/vendor/bundle/ruby/3.0.0/gems/ajax-datatables-rails-1.3.1/lib/ajax-datatables-rails/base.rb:4:in `<module:AjaxDatatablesRails>'
remote:         from /tmp/build_6d6e3419/vendor/bundle/ruby/3.0.0/gems/ajax-datatables-rails-1.3.1/lib/ajax-datatables-rails/base.rb:3:in `<main>'

...

ERROR in ./app/javascript/i18n-js/index.js.erb
remote:        Module build failed (from ./node_modules/rails-erb-loader/index.js):
remote:        Error: rails-erb-loader failed with code: 1
remote:            at ChildProcess.<anonymous> (/tmp/build_6d6e3419/node_modules/rails-erb-loader/index.js:128:16)
remote:            at ChildProcess.emit (events.js:310:20)
remote:            at maybeClose (internal/child_process.js:1021:16)
remote:            at Socket.<anonymous> (internal/child_process.js:443:11)
remote:            at Socket.emit (events.js:310:20)
remote:            at Pipe.<anonymous> (net.js:672:12)
remote:         @ ./app/javascript/packs/application.js 5:133-172 5:184-188 5:189-193
remote:        
remote:        ERROR in ./app/javascript/packs/hello_erb.js.erb
remote:        Module build failed (from ./node_modules/rails-erb-loader/index.js):
remote:        Error: rails-erb-loader failed with code: 1
remote:            at ChildProcess.<anonymous> (/tmp/build_6d6e3419/node_modules/rails-erb-loader/index.js:128:16)
remote:            at ChildProcess.emit (events.js:310:20)
remote:            at maybeClose (internal/child_process.js:1021:16)
remote:            at Socket.<anonymous> (internal/child_process.js:443:11)
remote:            at Socket.emit (events.js:310:20)
remote:            at Pipe.<anonymous> (net.js:672:12)

...

remote:  !
remote:  !     Precompiling assets failed.
remote:  !     Attempted to access a nonexistent database:
remote:  !     https://devcenter.heroku.com/articles/pre-provision-database
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed

The deploy only works successfully if I remove the ajax-datatables-rails gem from the Gemfile or ask heroku to provision the database before anything else:

heroku addons:create heroku-postgresql:hobby-dev
timdiggins commented 3 years ago

Just stopping by (not yet a user of this gem), but I think the problem here is that rails is trying to access to the database to generate assets - this happens with a lot of setups, not just this gem. So ensuring there's a db before deploying to heroku doesn't seem like a problem with this gem.

the critical lines in the output are:

remote:  !     Precompiling assets failed.
remote:  !     Attempted to access a nonexistent database:
remote:  !     https://devcenter.heroku.com/articles/pre-provision-database
n-rodriguez commented 2 years ago

remote: ! Attempted to access a nonexistent database:

Seems to be a duplicate of https://github.com/jbox-web/ajax-datatables-rails/issues/388

n-rodriguez commented 1 year ago

Should be fixed by : https://github.com/jbox-web/ajax-datatables-rails/commit/5c0e274ff2aa750f4198d4a9bff851895908c9c1