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

fix: Get product image uploads working again #6309

Merged
merged 3 commits into from
Nov 18, 2020
Merged

fix: Get product image uploads working again #6309

merged 3 commits into from
Nov 18, 2020

Conversation

focusaurus
Copy link
Contributor

Resolves #6298
Impact: minor
Type: bugfix

Issue

Uploading product images from within reaction-admin was failing consistently with a chain of errors originating deep within our file upload stack (file-collections, the upload server, and supporting code). See #6298 for more details but ultimately there was a nodejs stream object representing the write to gridfs, and code was calling stream.destroy(). The normal behavior for that is to emit an "error" event with no arguments. I believe that bit of code is functioning as designed. In the reaction code, we bound event listeners to this event but failed to handle the case when this event had to passed arguments.

Solution

The fixes amounted to detecting these spurious error events and ignoring them, allowing things to proceed successfully.

Breaking changes

None expected.

Testing

  1. Run reaction from this branch in dev mode
  • The release for this doesn't have a prod mode docker image yet, so we can only test the updated deps in dev mode
  1. In reaction-admin, create a product and add images. It should work.

I've tested top-level product images and variants and they work.

- Fixes #6298 mostly by updating to dependencies with the fixes
  - @reactioncommerce/[email protected]
  - @reactioncommerce/[email protected]
  - @reactioncommerce/[email protected]
- Also switch to the node v14.15.0 docker-base images
  - Unclear if this is strickly required but yet again
    the sharp package native add-on compiling was failing with
    C dependency errors

Signed-off-by: Peter Lyons <[email protected]>
@focusaurus
Copy link
Contributor Author

Ah, I now see that DCO wants mailchimp email addresses. OK fixed that.

@focusaurus
Copy link
Contributor Author

@mikemurray Do you know if this is CircleCI being slow?

 FAIL  tests/integration/api/queries/ping/ping.test.js
  ● Test suite failed to run

    MongoServerSelectionError: Server selection timed out after 30000 ms

      at Timeout._onTimeout (node_modules/mongodb/lib/core/sdam/topology.js:438:30)

@kieckhafer
Copy link
Member

I am now able to upload an initial image with this PR, however, I am still running into an error when trying to duplicate a product that has an image on it. It seems related, but this is a good first step: #6310

@willopez
Copy link
Member

Yup, seems like it. Ran test locally and they all completed successfully. Also tested uploading images and works! Great job!

willopez
willopez previously approved these changes Nov 17, 2020
Copy link
Member

@willopez willopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@focusaurus
Copy link
Contributor Author

I added another commit that hopefully will fix #6310 too. Tomorrow will look into CI timing out with mongo errors.

@willopez
Copy link
Member

@focusaurus I have verified that duplicating variants with images works as expected.

@focusaurus
Copy link
Contributor Author

CI is fixed with a new release of api-core.

Copy link
Member

@willopez willopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kieckhafer kieckhafer self-requested a review November 18, 2020 23:38
Copy link
Member

@kieckhafer kieckhafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good, #6310 is fixed as well, nice work!

@focusaurus focusaurus merged commit fc23ba8 into trunk Nov 18, 2020
@focusaurus focusaurus deleted the bug-6298 branch November 18, 2020 23:47
@mikemurray mikemurray mentioned this pull request Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upload images - Runtime error
3 participants