Mange / roadie-rails

Making HTML emails comfortable for the Rails rockstars
MIT License
367 stars 66 forks source link

Asset Pipeline Could Not Find Stylesheet #45

Closed jaymiejones86 closed 9 years ago

jaymiejones86 commented 9 years ago

I am using the automatic processing of emails in a Rails 4.2.3 app and am running into the following issue (note, I have seen similar issues but I think mine may be slightly different):

JobNotifier#job_closed_notification: processed outbound mail in 50.1ms
Performed ActionMailer::DeliveryJob from Inline(mailers) in 60.06ms
Roadie::CssNotFound: Could not find stylesheet "/assets/email.self-4e2f05105e9cb156e618b1a28f953e1e201a4200fdad37ab0658af40d798c045.css?body=1"
Used provider:
ProviderList: [
        #<Roadie::Rails::AssetPipelineProvider:0x007fd8a9e0dbc8>
]

This error is happening in production and development, it seems the hash is different. In development when I compile the assets, the path is right but the hash is different.

/assets/email-4e2f05105e9cb156e618b1a28f953e1e201a4200fdad37ab0658af40d798c045.css

Notice how self is in the version by roadie?

The email stylesheet is being loaded in at:

Rails.application.config.assets.precompile += %w( email.css )
jaymiejones86 commented 9 years ago

The console output was pretty much spot on to the console output in #42

Mange commented 9 years ago

Can you verify the HTML output? Add a Roadie::NullProvider to the provider list and check out the resulting email. Could it be that your views are adding this .self for some reason?

jaymiejones86 commented 9 years ago

Sorry @Mange this looks like a serious case of Gremlins. Did not touch any code and now it is all working after leaving it overnight.

VERY BIZARRE.

Mange commented 9 years ago

I'm glad it worked our for you. ☺

ons 12 aug 2015 04:59 Jaymie Jones notifications@github.com skrev:

Closed #45 https://github.com/Mange/roadie-rails/issues/45.

— Reply to this email directly or view it on GitHub https://github.com/Mange/roadie-rails/issues/45#event-379875687.

saten commented 8 years ago

having the same issue here Roadie::ProvidersFailed - Could not find stylesheet "/assets/mail.self-ec2278f...."

if I remove the require_self line in mail.css the errors move on the next require line.

thermistor commented 8 years ago

I was also having a similar problem:

2016-03-12T06:44:49.766Z 7346 TID-oxvpg3h3s WARN: Roadie::CssNotFound: Could not find stylesheet "/assets/email.self-695a130fdb2923902b47f8c8847c18ef281ee06750a0795d9275b8fbf8400dbb.css?body=1"
Used provider:
ProviderList: [
  #<Roadie::FilesystemProvider:0x007ffcb29776b8>
]

I traced it to updating sass-rails from 4.0.5 to 5.0.4 (sass-rails 5.0.4 brings in a much newer sprockets as well), reverting sass-rails to 4.0.5 fixed the issue for me.

Mange commented 8 years ago

This is clearly something I need to investigate now.

Thanks for the extra details!

Den lör 12 mars 2016 08:42Weston Triemstra notifications@github.com skrev:

I was also having a similar problem:

2016-03-12T06:44:49.766Z 7346 TID-oxvpg3h3s WARN: Roadie::CssNotFound: Could not find stylesheet "/assets/email.self-695a130fdb2923902b47f8c8847c18ef281ee06750a0795d9275b8fbf8400dbb.css?body=1" Used provider: ProviderList: [

Roadie::FilesystemProvider:0x007ffcb29776b8

]

I traced it to updating sass-rails from 4.0.5 to 5.0.4 (sass-rails 5.0.4 brings in a much newer sprockets as well), reverting sass-rails to 4.0.5 fixed the issue for me.

— Reply to this email directly or view it on GitHub https://github.com/Mange/roadie-rails/issues/45#issuecomment-195685150.

jufemaiz commented 8 years ago

Can confirm this one too.

Should specs be using compiled assets?

ryankc33 commented 8 years ago

Running into this problem too. Seems that Roadie is looking for precompiled assets in the test environment.

Hamdan85 commented 4 years ago

that was any development in this matter? I'm experiencing the issue.

Mange commented 4 years ago

Sorry, I forgot about this. Since the gem is now in passive maintenance mode, I'm waiting for someone else to find the cause and propose a fix.

I'm not using this gem myself, and in the Rails app I'm currently passively maintaining, we don't use the asset pipeline anyway.

The issue seems to be how the gem tries to auto-detect that asset pipeline is enabled before it adds the provider for live-compiled assets. That probably fails because some option was moved around, which makes it only pick the pre-compiled assets provider.

Worst-case, you could just manually add the right provider in your config and stop relying on the auto-detection.