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

Not able to publish product #5414

Closed
willopez opened this issue Aug 2, 2019 · 7 comments
Closed

Not able to publish product #5414

willopez opened this issue Aug 2, 2019 · 7 comments
Assignees
Labels
bug For issues that describe a defect or regression in the released software

Comments

@willopez
Copy link
Member

willopez commented Aug 2, 2019

Issue Description

When creating a new product, I am unable to publish it.

Steps to Reproduce

Please provide starting context, i.e. logged in as a user, configure a particular payment method.

  1. Start Reaction in latest develop
  2. Create a new product and enable inventory tracking for an option
  3. Attempt to publish product

Generates the following error:

Error in "afterInventoryUpdate" consumer TypeError: Cannot destructure property `product` of 'undefined' or 'null'.
reaction_1  |       at Promise.asyncApply (imports/plugins/core/catalog/server/no-meteor/mutations/partialProductPublish.js:9:88)

Scenario 2.

  1. Start Reaction on latest develop
  2. Create a new product and do NOT enable inventory tracking for variant nor option
  3. Attempt to publish product

Generates the following error:

Exception while invoking method 'catalog/publish/products' Error: Input passed into "inventoryForProductConfigurations" was invalid: inventoryInputInvalidPropertyValue[productConfigurations]
reaction_1  |     at Promise.asyncApply (imports/plugins/core/inventory/server/no-meteor/queries/inventoryForProductConfigurations.js:120:11)

Possible Solution

Before calling the new partial publish function, it's necessary to ensure that inventory tracking is actually enabled. Further, do not publish inventory props when inventory tracking is NOT enable.

Just my quick thoughts, might be the solution, might not be.

@willopez willopez added the bug For issues that describe a defect or regression in the released software label Aug 2, 2019
@impactmass impactmass removed their assignment Aug 5, 2019
@impactmass
Copy link
Contributor

cc @aldeed @kieckhafer

@kieckhafer
Copy link
Member

kieckhafer commented Aug 5, 2019

@willopez

I actually don't think this is directly inventory's fault.

It seems the root of the issue here is on this line: https://github.com/reactioncommerce/reaction/blob/develop/imports/plugins/core/catalog/server/no-meteor/mutations/partialProductPublish.js#L12

Because this is a new product, it hasn't yet been published to the Catalog, so that's why catalogItem returns no data, because it doesn't exist.

Updating the default product works, because it's already been published to the catalog.

Possible solution, on line 13:
if (!catalogProduct) return; to kill this process if it hasn't been published yet.

I'm not sure the overall consequences of that throughout other packages, but I'd start there.

@aldeed
Copy link
Contributor

aldeed commented Aug 5, 2019

Yes, this was an oversight by Nat and I when we made partialProductPublish. I agree with @kieckhafer about how to fix. It would be a good idea to fix this in release-2.1.0 branch before that is released @willopez.

@aldeed aldeed mentioned this issue Aug 5, 2019
@willopez
Copy link
Member Author

willopez commented Aug 6, 2019

After some more research, the root issue is caused by attempting to publish a new product without setting a product its variants + options to be visible. If variants or products are not set to be visible, the publish function fails and the user is not notified regarding invisible variants + options. Guard login needs to be added to check for input to include variants or variants + options before attempting to publish.

@aldeed
Copy link
Contributor

aldeed commented Aug 7, 2019

Pretty sure the fix @kieckhafer mentions is also needed, though, if you update any inventory fields before publishing for the first time.

@willopez
Copy link
Member Author

willopez commented Aug 7, 2019

@aldeed Yes, the checks @kieckhafer suggested are needed.

@willopez
Copy link
Member Author

willopez commented Aug 7, 2019

Resolved in #5433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For issues that describe a defect or regression in the released software
Projects
None yet
Development

No branches or pull requests

4 participants