solidusio / solidus

🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
https://solidus.io
Other
4.99k stars 1.29k forks source link

API calls fail on Solidus engines mounted with namespace #2700

Open davideghz opened 6 years ago

davideghz commented 6 years ago

Steps to reproduce

Expected behavior

I should be able to add product variants to order

Actual behavior

In JS console I see a failing call to http://localhost:3000/api/orders/[:order_number] and "Add Item" button is disabled

System configuration

Solidus Version: ~> 2.5

note: I see this behavior only in my local environment, not in production note 2: all the API calls are broken, not only /api/orders

davideghz commented 6 years ago

I just noticed that

https://github.com/solidusio/solidus/blob/cf9eebdf62a1fb2512f6b40243c9d89410d4dba7/core/app/assets/javascripts/spree.js.erb#L15-L17

is evaluated as

Spree.mountedAt = function() {
  return "/";
};

while in my rails console I get

2.4.2 :001 > Rails.application.routes.url_helpers.spree_path(trailing_slash: true)
 => "/store/" 

not sure how to proceed from here tho

jordan81 commented 6 years ago

I'm running into I think the same issue with mounting not engine not at the root. Viewing and Creating new Taxons is not working when changing mounting location from '/'. 404 errors show file not found for "/api/taxononomies/" when mounting point is /store/ using the "Add Taxon" Button.

readysetawesome commented 4 years ago

I think I'm running into the same issue. basically mount with 'at' doesn't work for me at all, all product page links are broken as soon as I mount at something other than the root path. I don't understand why some links are working (i.e. admin sections) but the store itself is totally broken with incorrect product links.

-edit- Problem solved - Rails.cache.clear