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

Solidus Support 0.9 breaks loading of Solidus Auth Devise in Rails 5.2 (and possibly other extensions) #73

Closed
Noah-Silvera opened this issue Jul 21, 2022 · 4 comments

Comments

@Noah-Silvera
Copy link

Noah-Silvera commented Jul 21, 2022

A change introduced Solidus Support 0.9 #65 causes the solidus auth devise controllers not to be eager loaded on boot in rails 5.2

This results in this error message when trying to access the solidus admin. This is a failure to load a controller constant from solidus_auth_devise

Screen Shot 2022-07-21 at 13 21 25PDT

This can be reproduced in an app with the following setup

Rails 5.2.8.1
Solidus 2.11.17
Solidus Support 0.9.0
Solidus Auth Devise 2.5.4

  • Set eager_load = true in development.rb

Here is a repository with a pre-setup app to reproduce it.
https://github.com/Noah-Silvera/solidus-support-0.9-engine-bug

If you comment out this initializer block,

       # initializer "#{name}_#{engine}_paths", before: :initialize_cache do
          if SolidusSupport.send(:"#{engine}_available?")
            paths['app/controllers'] << "lib/controllers/#{engine}"
            paths['app/views'] << "lib/views/#{engine}"
          end
       # end

The error is resolved.

I suspect this is due to a different in code loading in Rails 5 and Rails 6, which introduced zeitwerk, or a change in how/when railties processes initializers.

@gsmendoza
Copy link
Contributor

Hi @Noah-Silvera ! I was able to confirm your issue, and it seems I was able to work around it by downgrading SolidusSupport to 0.8.1. Please see Noah-Silvera/solidus-support-0.9-engine-bug#1.

Is there a reason you need to use SolidusSupport 0.9.0 on your Rails 5.2 app? Based on https://endoflife.date/rails and https://guides.rubyonrails.org/maintenance_policy.html, support for Rails 5.2 has already ended. Thus, it's not likely we'll update this gem to support Rails 5.2.

@Noah-Silvera
Copy link
Author

Hey @gsmendoza!

Yeah, it can definitely be worked around by downgrading to 0.8.1! I was able to workaround that on my app.
And you are totally right, rails 5.2 is at end of life! So that's super fair not to update this gem. Just wanted to point the issue out, feel free to close this!

@Noah-Silvera
Copy link
Author

I appreciate you looking into this and confirming this!

@gsmendoza
Copy link
Contributor

@Noah-Silvera Good to hear you were able to work around the issue. I'll be closing this issue.

MassimilianoLattanzio added a commit to sdtechdev/solidus_support that referenced this issue May 10, 2024
In solidusio#65 and solidusio#71
they changed how the engine i loaded using the Rails initializers.
This updates causes some issues when using Rails <6.1 because
the initializers are totally different. The solution is to load
the extension outside of the initializer block until we use Rails 6.1
or newer version.

Ref: solidusio#73.
MassimilianoLattanzio added a commit to sdtechdev/solidus_support that referenced this issue May 10, 2024
In solidusio#65 and solidusio#71
they changed how the engine is loaded using the Rails initializers.
This updates causes some issues when using Rails < 6.1 because
the initializers are totally different. The solution is to load
the extension outside of the initializer block until we use Rails 6.1
or newer version.

Ref: solidusio#73.
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