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

Errors running in Production mode config.eager_load = true #6038

Open
magpieuk opened this issue Dec 18, 2024 · 2 comments · May be fixed by #6039
Open

Errors running in Production mode config.eager_load = true #6038

magpieuk opened this issue Dec 18, 2024 · 2 comments · May be fixed by #6039

Comments

@magpieuk
Copy link

Solidus Version:4.4.2

To Reproduce
Deployed to VPS via capistrano. Ruby 3.2.2 Rails 7.2.2.1
Navigate to admin/orders - error
NameError (undefined local variable or method `spree' for #<SolidusLegacyPromotions::Orders::Index::Component:0x00007f75d1a0b380

navigate to admin/products - error
NameError (undefined local variable or method `spree' for #<SolidusAdmin::Products::Index::Component:0x00007f75ca9ad7a0

With eager loading off pages load.

@magpieuk
Copy link
Author

magpieuk commented Dec 18, 2024

solidus (4.4.2)
solidus_api (= 4.4.2)
solidus_backend (= 4.4.2)
solidus_core (= 4.4.2)
solidus_legacy_promotions (= 4.4.2)
solidus_sample (= 4.4.2)
solidus_admin (0.3.2)
geared_pagination (> 1.1)
importmap-rails (
> 1.2, >= 1.2.1)
solidus_backend
solidus_core (> 4.2)
stimulus-rails (> 1.2)
turbo-rails (
> 2.0)
view_component (> 3.9)
solidus_api (4.4.2)
jbuilder (
> 2.8)
kaminari-activerecord (> 1.1)
responders
solidus_core (= 4.4.2)
solidus_backend (4.4.2)
font-awesome-rails (
> 4.0)
handlebars_assets (> 0.23)
jbuilder (
> 2.8)
jquery-rails
kaminari (> 1.1)
responders
sassc-rails
solidus_api (= 4.4.2)
solidus_core (= 4.4.2)
solidus_core (4.4.2)
actionmailer (>= 7.0, < 8.0.0.beta1)
actionpack (>= 7.0, < 8.0.0.beta1)
actionview (>= 7.0, < 8.0.0.beta1)
activejob (>= 7.0, < 8.0.0.beta1)
activemerchant (
> 1.66)
activemodel (>= 7.0, < 8.0.0.beta1)
activerecord (>= 7.0, < 8.0.0.beta1)
activestorage (>= 7.0, < 8.0.0.beta1)
activesupport (>= 7.0, < 8.0.0.beta1)
acts_as_list (< 2.0)
awesome_nested_set (> 3.3, >= 3.7.0)
cancancan (>= 2.2, < 4.0)
carmen (
> 1.1.0)
discard (> 1.0)
friendly_id (
> 5.0)
image_processing (> 1.10)
kaminari-activerecord (
> 1.1)
kt-paperclip (>= 6.3, < 8)
mini_magick (> 4.10)
monetize (
> 1.8)
omnes (> 0.2.2)
psych (>= 4.0.1, < 6.0)
railties (>= 7.0, < 8.0.0.beta1)
ransack (
> 4.0, < 5)
sprockets-rails (!= 3.5.0)
state_machines-activerecord (> 0.6)
solidus_legacy_promotions (4.4.2)
solidus_api (= 4.4.2)
solidus_core (= 4.4.2)
solidus_support
solidus_promotions (4.4.2)
importmap-rails (
> 1.2)
ransack-enum (> 1.0)
solidus_core (>= 4.0.0, < 5)
solidus_support (
> 0.5)
stimulus-rails (~> 1.2)
turbo-rails (>= 1.4)
solidus_sample (4.4.2)
solidus_core (= 4.4.2)
solidus_support (0.12.0)

@mamhoff
Copy link
Contributor

mamhoff commented Dec 18, 2024

Alright, I've managed to track some of this down: This does not happen in our sandbox, because the sandbox uses Devise, and devises loads all the application routes before eager loading. A quick fix could be


    # Force routes to be loaded if we are doing any eager load.
    config.before_eager_load do |app|
      app.reload_routes! 
    end

In an initializer. This is less than ideal though, as it slows the boot process down. We're actively looking at how to improve this.

mamhoff added a commit to mamhoff/solidus that referenced this issue Dec 18, 2024
Rather than implementing routing proxies ourselves, we can use what
Rails offers.

Fixes solidusio#6038
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

Successfully merging a pull request may close this issue.

2 participants