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

Exception without manifest.js in 4.0.0 #643

Closed
olivierlacan opened this issue Oct 17, 2019 · 10 comments
Closed

Exception without manifest.js in 4.0.0 #643

olivierlacan opened this issue Oct 17, 2019 · 10 comments

Comments

@olivierlacan
Copy link

Expected behavior

When no app/assets/config/manifest.js file, Sprockets should just warn that it's disabled or could not load, and not throw and error. Since our app doesn't include anything in app/assets, and only has Sprockets enabled for the same of the GraphiQL development interface (which does render views and assets but within a gem, not from our app). For this same reason we're not using config.api_only = true in config/application.rb because that would have disabled Sprockets and prevented this issue from occurring. I believe it's likely why few people caught this issue.

Actual behavior

An error is thrown since 4.0, this didn't occur on 3.7.2:

rake aborted!
  Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js`
  But did not, please create this file and use it to link any assets that need
  to be rendered by your app:
  
  Example:
    //= link_tree ../images
    //= link_directory ../javascripts .js
    //= link_directory ../stylesheets .css
  and restart your server

System configuration

  • Sprockets 4.0.0
  • Ruby 2.5.7
@rafaelfranca
Copy link
Member

How is the GraphiQL configuring sprockets? It should not be working if the application don't have a manifest because the application manifest need to tell sprockets to link the assets on engines.

@olivierlacan
Copy link
Author

olivierlacan commented Oct 17, 2019

@rafaelfranca
Copy link
Member

oh! So I think it will not work anymore unless you add a manifest in your app you could try to remove the initializer that raises locally and see if the javascripts for graphiql are being rendered.

@vividtone
Copy link

Redmine 4.0 (<= 4.0.4) and 3.4 (<= 3.4.11) are also affected this issue.
https://www.redmine.org/issues/32300

I think sprockets 4.0.0 should not raise the error if asset pipeline is disabled (config.assets.enabled is set to false).
https://www.redmine.org/projects/redmine/repository/entry/tags/4.0.5/config/application.rb#L40

@rafaelfranca
Copy link
Member

That is disabling assets compilation but not sprockets. If you want to disable sprockets you need to change the require 'rails/all' to require the individual railties and leave the sprockets railties out of the list.

@ashrafalzyoud
Copy link

its not working yet in Rev 18859
its give error in ASSET IN REDMINE 4.0.5

@ashrafalzyoud
Copy link

redmine@redmine:~/redmine-4.0$ bundle exec rake db:migrate RAILS_ENV=production rake aborted!
NoMethodError: undefined method assets' for #<Rails::Engine::Configuration:0x0000563025980d90> /home/redmine/redmine-4.0/config/application.rb:28:in <top (required)>'
/home/redmine/redmine-4.0/Rakefile:5:in require' /home/redmine/redmine-4.0/Rakefile:5:in <top (required)>'
/home/redmine/.rbenv/versions/2.5.5/bin/bundle:23:in load' /home/redmine/.rbenv/versions/2.5.5/bin/bundle:23:in

'
(See full trace by running task with --trace)

@ashrafalzyoud
Copy link

Redmine 4.0 (<= 4.0.4) and 3.4 (<= 3.4.11) are also affected this issue.
https://www.redmine.org/issues/32300

I think sprockets 4.0.0 should not raise the error if asset pipeline is disabled (config.assets.enabled is set to false).
https://www.redmine.org/projects/redmine/repository/entry/tags/4.0.5/config/application.rb#L40
redmine@redmine:~/redmine-4.0$ bundle exec rake db:migrate RAILS_ENV=production rake aborted!
NoMethodError: undefined method assets' for #<Rails::Engine::Configuration:0x0000563025980d90> /home/redmine/redmine-4.0/config/application.rb:28:in <top (required)>'
/home/redmine/redmine-4.0/Rakefile:5:in require' /home/redmine/redmine-4.0/Rakefile:5:in <top (required)>'
/home/redmine/.rbenv/versions/2.5.5/bin/bundle:23:in load' /home/redmine/.rbenv/versions/2.5.5/bin/bundle:23:in

'
(See full trace by running task with --trace)

@vividtone
Copy link

@ashrafalzyoud Could you open an issue on https://www.redmine.org/ ?

@rafaelfranca
Copy link
Member

Closing since this isn't an issue. Sprockets 4 requires a manifest, of if you don't need sprockets remove it from the application.

@rafaelfranca rafaelfranca closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2022
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

4 participants