solidusio/solidus

Unable to add product in admin panel

Closed this issue · 3 comments

When i go to admin panel, i click on "New product " , i get routes error

Solidus Version:


2.7.3 :001 > Spree.solidus_version
 => "3.4.3" 


To Reproduce

  1. Go to admin panel
  2. Click on products
  3. Click on new product
image

Current behavior

get this error :

Started GET "/admin/products/new" for 127.0.0.1 at 2023-07-22 14:45:29 +0200
Processing by Spree::Admin::ProductsController#new as HTML
  Spree::User Load (0.1ms)  SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = ? ORDER BY "spree_users"."id" ASC LIMIT ?  [["id", 1], ["LIMIT", 1]]
  Spree::Role Load (0.0ms)  SELECT "spree_roles".* FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = ?  [["user_id", 1]]
  Spree::TaxCategory Load (0.0ms)  SELECT "spree_tax_categories".* FROM "spree_tax_categories" WHERE "spree_tax_categories"."deleted_at" IS NULL ORDER BY "spree_tax_categories"."name" ASC
  Spree::Store Load (0.0ms)  SELECT "spree_stores".* FROM "spree_stores" WHERE ("spree_stores"."url" = ? OR "spree_stores"."default" = ?) ORDER BY "spree_stores"."default" ASC LIMIT ?  [["url", "localhost"], ["default", 1], ["LIMIT", 1]]
  Spree::Store Load (0.0ms)  SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."default" = ? ORDER BY "spree_stores"."id" ASC LIMIT ?  [["default", 1], ["LIMIT", 1]]
  CACHE Spree::Store Load (0.0ms)  SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."default" = ? ORDER BY "spree_stores"."id" ASC LIMIT ?  [["default", 1], ["LIMIT", 1]]
Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.2ms | Allocations: 13324)


  
ActionController::UrlGenerationError (No route matches {:action=>"show", :controller=>"spree/products", :id=>#<Spree::Product id: nil, name: "", description: nil, available_on: nil, deleted_at: nil, slug: nil, meta_description: nil, meta_keywords: nil, tax_category_id: nil, shipping_category_id: nil, created_at: nil, updated_at: nil, promotionable: true, meta_title: nil, discontinue_on: nil>}, possible unmatched constraints: [:id]
Did you mean?  products_url):
  
actionpack (7.0.6) lib/action_dispatch/journey/formatter.rb:44:in `path'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:824:in `url_for'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:271:in `call'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:214:in `call'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:327:in `block in define_url_helper'
solidus_seo (71fe53b7555b) app/decorators/models/spree/product_decorator.rb:16:in `seo_url'
solidus_seo (71fe53b7555b) app/decorators/models/spree/product_decorator.rb:55:in `seo_data'
solidus_seo (71fe53b7555b) lib/solidus_seo/model.rb:12:in `to_seo'
solidus_seo (71fe53b7555b) lib/solidus_seo/meta_data_builder.rb:37:in `resource_meta_data'
solidus_seo (71fe53b7555b) lib/solidus_seo/meta_data_builder.rb:26:in `set_meta_data'
solidus_seo (71fe53b7555b) lib/solidus_seo/meta_data_builder.rb:11:in `render'
solidus_backend (3.4.3) app/controllers/spree/admin/resource_controller.rb:18:in `block (2 levels) in new'
responders (3.1.0) lib/action_controller/responder.rb:241:in `default_render'
responders (3.1.0) lib/action_controller/responder.rb:175:in `to_html'
responders (3.1.0) lib/action_controller/responder.rb:168:in `respond'
responders (3.1.0) lib/action_controller/responder.rb:161:in `call'
responders (3.1.0) lib/action_controller/respond_with.rb:216:in `respond_with'
solidus_backend (3.4.3) app/controllers/spree/admin/resource_controller.rb:17:in `new'
actionpack (7.0.6) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.6) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.6) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.0.6) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.6) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
actiontext (7.0.6) lib/action_text/rendering.rb:20:in `with_renderer'
actiontext (7.0.6) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
activesupport (7.0.6) lib/active_support/callbacks.rb:127:in `instance_exec'
activesupport (7.0.6) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.6) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.6) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.6) lib/action_controller/metal/rescue.rb:23:in `process_action'
actionpack (7.0.6) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.6) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.6) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.6) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.6) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.6) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.6) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.6) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.6) lib/action_view/rendering.rb:39:in `process'
actionpack (7.0.6) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.6) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.6) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.6) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.6) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:852:in `call'
railties (7.0.6) lib/rails/engine.rb:530:in `call'
railties (7.0.6) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.6) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.0.6) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (7.0.6) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.6) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.6) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.6) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.6) lib/action_dispatch/routing/route_set.rb:852:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/static.rb:23:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (2.2.7) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.7) lib/rack/etag.rb:27:in `call'
rack (2.2.7) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.7) lib/rack/head.rb:12:in `call'
actionpack (7.0.6) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
actionpack (7.0.6) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
rack (2.2.7) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.7) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/cookies.rb:704:in `call'
activerecord (7.0.6) lib/active_record/migration.rb:603:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.6) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.6) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `catch'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
railties (7.0.6) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.6) lib/rails/rack/logger.rb:25:in `block in call'
activesupport (7.0.6) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (7.0.6) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (7.0.6) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (7.0.6) lib/rails/rack/logger.rb:25:in `call'
sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.7) lib/rack/method_override.rb:24:in `call'
rack (2.2.7) lib/rack/runtime.rb:22:in `call'
activesupport (7.0.6) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
actionpack (7.0.6) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
actionpack (7.0.6) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.7) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.6) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
railties (7.0.6) lib/rails/engine.rb:530:in `call'
puma (5.6.6) lib/puma/configuration.rb:252:in `call'
puma (5.6.6) lib/puma/request.rb:77:in `block in handle_request'
puma (5.6.6) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
puma (5.6.6) lib/puma/request.rb:76:in `handle_request'
puma (5.6.6) lib/puma/server.rb:443:in `process_client'
puma (5.6.6) lib/puma/thread_pool.rb:147:in `block in spawn_thread'


This happen in this URL: http://localhost:3000/xbenh/admin/products/new

Expected behavior
I should have the product new form

Screenshots

Desktop (please complete the following information):

  • OS: MAC OS 12.0.1
  • Browser chrome
  • Version 114.0.5735.198 (Build officiel) (arm64)

Additional context
I have a very simple application:
Here is my routes

Rails.application.routes.draw do

  root to: 'home#index'

  get '/about', to: 'pages#about', as: :about
  get '/faq', to: 'pages#faq', as: :faq


  devise_for(:user, {
    class_name: 'Spree::User',
    singular: :spree_user,
    controllers: {
      sessions: 'user_sessions',
      registrations: 'user_registrations',
      passwords: 'user_passwords',
      confirmations: 'user_confirmations'
    },
    skip: [:unlocks, :omniauth_callbacks],
    path_names: { sign_out: 'logout' }
  })

  resources :users, only: [:edit, :update]

  devise_scope :spree_user do
    get '/login', to: 'user_sessions#new', as: :login
    post '/login', to: 'user_sessions#create', as: :create_new_session
    match '/logout', to: 'user_sessions#destroy', as: :logout, via: Devise.sign_out_via
    get '/signup', to: 'user_registrations#new', as: :signup
    post '/signup', to: 'user_registrations#create', as: :registration
    get '/password/recover', to: 'user_passwords#new', as: :recover_password
    post '/password/recover', to: 'user_passwords#create', as: :reset_password
    get '/password/change', to: 'user_passwords#edit', as: :edit_password
    put '/password/change', to: 'user_passwords#update', as: :update_password
    get '/confirm', to: 'user_confirmations#show', as: :confirmation if Spree::Auth::Config[:confirmable]
  end

  resource :account, controller: 'users'

  resources :products, only: [:index, :show]

  resources :cart_line_items, only: :create

  get '/locale/set', to: 'locale#set'
  post '/locale/set', to: 'locale#set', as: :select_locale

  resource :checkout_session, only: :new
  resource :checkout_guest_session, only: :create

  # non-restful checkout stuff
  patch '/checkout/update/:state', to: 'checkouts#update', as: :update_checkout
  get '/checkout/:state', to: 'checkouts#edit', as: :checkout_state
  get '/checkout', to: 'checkouts#edit', as: :checkout

  get '/orders/:id/token/:token' => 'orders#show', as: :token_order

  resources :orders, only: :show do
    resources :coupon_codes, only: :create
  end

  resource :cart, only: [:edit, :update] do
    put 'empty'
  end

  # route globbing for pretty nested taxon and product paths
  get '/t/*id', to: 'taxons#show', as: :nested_taxons

  get '/unauthorized', to: 'home#unauthorized', as: :unauthorized
  get '/cart_link', to: 'store#cart_link', as: :cart_link

  # This line mounts Solidus's routes at the root of your application.
  # This means, any requests to URLs such as /products, will go to Spree::ProductsController.
  # If you would like to change where this engine is mounted, simply change the :at option to something different.
  #
  # We ask that you don't use the :as option here, as Solidus relies on it being the default of "spree"
  mount Spree::Core::Engine, at: '/'
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

  # Defines the root path route ("/")
  # root "articles#index"

end

and my gemfile

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "2.7.3"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.6"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.0"
gem "connection_pool"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Sass to process CSS
# gem "sassc-rails"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development, :test do
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
  #gem "debug", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"

  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
  gem 'letter_opener', '~> 1.8.1'
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara"
  gem "selenium-webdriver"
  gem "webdrivers"
end


gem "solidus_core", "3.4.3"
gem "solidus_backend", "3.4.3"
gem "solidus_api", "3.4.3"
gem "solidus_sample", "3.4.3"
gem "canonical-rails"
gem "solidus_support"
gem "truncate_html"
gem "view_component", "~> 2.46"

group :development, :test do
  gem "rspec-rails"
  gem "apparition", "~> 0.6.0", github: "twalpole/apparition"
  gem "rails-controller-testing", "~> 1.0.5"
  gem "rspec-activemodel-mocks", "~> 1.1.0"
  gem "capybara-screenshot", "~> 1.0"
  gem "database_cleaner", "~> 1.7"
  gem "factory_bot", ">= 4.8"
  gem "factory_bot_rails"
  gem "ffaker", "~> 2.13"
  gem "rubocop", "~> 1.0"
  gem "rubocop-performance", "~> 1.5"
  gem "rubocop-rails", "~> 2.3"
  gem "rubocop-rspec", "~> 2.0"
end

# FIXME: Please remove this line if `solidus_auth_devise` appears anywhere else in the gemfile
#        or replace it with a simple `gem 'solidus_auth_devise'` otherwise.
gem 'solidus_auth_devise' unless File.read(__FILE__).lines[__LINE__..-1].grep(/solidus_auth_devise/).any?

gem "solidus_auth_devise", "~> 2.5"
gem 'solidus_editor'

gem 'solidus_i18n'
gem 'rails-i18n'
gem 'kaminari-i18n'

group :production, :staging do
  gem 'pg'
end

gem "aws-sdk-s3", require: false
gem 'jquery-ui-rails'
gem "font-awesome-sass", "~> 6.2.1"
gem 'sitemap_generator', require: false
gem 'whenever', require: false


@RedaBenh please assign this to me i love to contribute too

thanks @Aaryanpal and @elia
Yes , you were right the gem solidus_seo does not suport Solidus v3. so it's not an issue.
by removing this solidus_seo gem, i'm able to add a product.
there is a request to support Solidus v3 here karmakatahdin/solidus_seo#27