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

UnknownAttributeError creating a product via API with a Permalink #3988

Closed
kennyadsl opened this issue Mar 12, 2021 · 0 comments
Closed

UnknownAttributeError creating a product via API with a Permalink #3988

kennyadsl opened this issue Mar 12, 2021 · 0 comments
Labels
changelog:solidus_api Changes to the solidus_api gem type:bug Error, flaw or fault

Comments

@kennyadsl
Copy link
Member

Solidus Version:
2.11.5, master

ActiveModel::UnknownAttributeError

To Reproduce

Trying to create a product with the permalink attribute included:

curl -si \
--header 'Authorization: Bearer <PLACE_API_KEY_HERE>' \
--header 'content-type: application/json' \
--request POST --url https://<PLACE_HOST_HERE>/api/products \
--data  '{"product": {"name":"Eraseme_2","permalink":null,"description":"To be erased.","meta_description":"","meta_keywords":"","price":"1000.0","sku":"ERS000001", "deleted_at":null,"option_values_hash":null,"weight":"0.0","height":null,"width":null,"depth":null,"shipping_category_id":1}}'

Current behavior

We get this 500 error.

ActiveModel::UnknownAttributeError in Spree::Api::ProductsController#create
unknown attribute 'permalink' for Spree::Product. 
Extracted source (around line #52)
          public_send(setter, v)
        else
          raise UnknownAttributeError.new(self, k)
        end
      end
  end

Expected behavior

I think that request should be successful, so we should understand why this is happening in the first place and fix it.

Alternatively, if the error is legit for some reason, we should not make the application explode but gracefully return an API error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_api Changes to the solidus_api gem type:bug Error, flaw or fault
Projects
None yet
Development

No branches or pull requests

1 participant