Addons-frontend: FormData is not defined in Node

Created on 5 Apr 2019  路  7Comments  路  Source: mozilla/addons-frontend

There is an error with FormData on the server:

ReferenceError: FormData is not defined

Let's use this lib to fix the problem: https://github.com/form-data/isomorphic-form-data~~ Nope, because of https://github.com/form-data/form-data/issues/403. I wrote: https://github.com/willdurand/isomorphic-formdata, which uses https://github.com/octet-stream/form-data in node context.

I believe we did not run into this problem earlier because we were not triggering one part of the code involving FormData before, but that seems weird because it is part of the api layer... Anyway, this bug has been revealed while working on #7842.

For QA: could you make sure uploading a profile picture still works?

code quality p3 pull request ready verified fixed bug

All 7 comments

@willdurand Is qa needed here? If yes, please add some STR
Thanks!

@ioanarusiczki thanks for the reminder, just added a note in the issue above 猬嗭笍

@willdurand Uploading images work for me on both AMO dev and AMO stage - FF66(Win10).

Two questions:

  • the maximum size allowed is 4GB, when uploading something bigger the red message received is Please use images smaller than 3MB. It's not a big deal, but I could file an issue to fix the message - replace 3 with 4.
  • I've noticed that the picture's placeholder is visibly larger ,64x64 pixels, and when the image is uploaded it looks smaller at 64x48. It's the same for a custom icon for an add-on. Then with inspector I see there is an avatar than an image property which have different sizes (please see the gif)
    Can't tell if it's alright or the image should fill the avatar's space at 64x64.

avatar versus image

* the maximum size allowed is 4GB, when uploading something bigger the red message received is     Please use images smaller than 3MB. It's not a big deal, but I  could file an issue to fix the message - replace 3 with 4.

Yep, I think this is an addons-server issue because we only show the server errors.

* I've noticed that the picture's placeholder is visibly larger ,64x64 pixels, and when the image is uploaded it looks smaller at 64x48. It's the same for a custom icon for an add-on.  Then with inspector I see there is an avatar than an image property which have different sizes (please see the gif)

This reminds me of an existing issue. I am not sure if it's intended or not. At first glance, it looks like a bug.

@willdurand
For the first thing, thanks for mentioning the server repo because I've searched a little and it was filed a while ago for the legacy pages and then fixed (funny thing, I filed it). So, I re-filed it for the new frontend https://github.com/mozilla/addons-server/issues/11186
For the second thing, I found only one issue filed but it's about the placeholder being too small https://github.com/mozilla/addons-frontend/issues/4648. I filed it here https://github.com/mozilla/addons-frontend/issues/7880, perhaps a contributor will notice it

thanks!

Was this page helpful?
0 / 5 - 0 ratings