solidus
solidus copied to clipboard
API calls fail on Solidus engines mounted with namespace
Steps to reproduce
- mount Solidus at a custom path, like
mount Spree::Core::Engine, at: '/store/'
- open browser at
/store/orders/[:order_number]/cart
page - check JS console for errors
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
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
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.
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