Skip to content

Errors in v4.4.0 storefront API calls #103

Description

@vbujas

I have managed to install spree globalize on Spree v.4.4.0.
In the backend everything seems to be in order. I can insert translations for taxons, products stores etc.
However, when I try ro make API calls from the next.js storefront i get a bunch of errors in spree

  1. a lot of "unpermitted parameter" erors such as:
    Unpermitted parameter: :taxon
    Unpermitted parameters: :image_transformation, :product

  2. Relation passed to #or must be structurally compatible. Incompatible values: [:readonly, :distinct]
    Here is a part of the stack trace before and after the erorr:

Unpermitted parameter: :cms_page
Unpermitted parameter: :taxon
Unpermitted parameter: :cms_page
Unpermitted parameter: :taxon
Unpermitted parameter: :taxon
`Relation passed to #or must be structurally compatible. Incompatible values: [:readonly, :distinct]
(1.8ms)  SELECT COUNT(*) FROM (SELECT 1 AS one FROM "spree_cms_pages" WHERE "spree_cms_pages"."deleted_at" IS NULL AND "spree_cms_pages"."store_id" = $1 AND "spree_cms_pages"."locale" = $2 LIMIT $3 OFFSET $4) subquery_for_count  [["store_id", 1], ["locale", "sr"], ["LIMIT", 500], ["OFFSET", 0]]
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation/query_methods.rb:725:in `or!'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation/query_methods.rb:715:in `or'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/spree_core-4.4.0/app/models/concerns/spree/product_scopes.rb:340:in `block in get_taxons'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/spree_core-4.4.0/app/models/concerns/spree/product_scopes.rb:336:in `map'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/spree_core-4.4.0/app/models/concerns/spree/product_scopes.rb:336:in `get_taxons'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/spree_core-4.4.0/app/models/concerns/spree/product_scopes.rb:110:in `block (2 levels) in <module:ProductScopes>'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation/delegation.rb:108:in `public_send'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation/delegation.rb:108:in `block in method_missing'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation.rb:406:in `block in scoping'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation.rb:804:in `_scoping'
/home/vladan/.rvm/gems/ruby-3.0.3/gems/activerecord-6.1.4.4/lib/active_record/relation.rb:406:in `scoping'`

  1. I also get a bunch of Eager load errors, sometimes telling me to add and sometimes to remove translations
GET /api/v2/storefront/taxons?filter%5Bparent_permalink%5D=meni
USE eager loading detected
  Spree::Taxon => [:translations]
  Add to your query: .includes([:translations])
Call stack
 
GET /api/v2/storefront/taxons?filter%5Bparent_permalink%5D=meni
AVOID eager loading detected
  Spree::Taxon => [:parent, :children, :taxonomy]
  Remove from your query: .includes([:parent, :children, :taxonomy])
Call stack
 
GET /api/v2/storefront/taxons?filter%5Bparent_permalink%5D=meni
AVOID eager loading detected
  Spree::Taxon => [:icon, :parent, :taxonomy]
  Remove from your query: .includes([:icon, :parent, :taxonomy])
Call stack
 
GET /api/v2/storefront/taxons?filter%5Bparent_permalink%5D=meni
AVOID eager loading detected
  Spree::Taxonomy => [:root]
  Remove from your query: .includes([:root])
Call stack

So it seams that spree_globalize is not compatible with version 4.4.0 and the storefrint API.
Is there a fix for this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions