formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.83k stars 1.05k forks source link

s3.js uploadFile: missing data.headers results in TypeError #5475

Closed danman01 closed 5 months ago

danman01 commented 5 months ago

I recently updated from 4.17.2 to 4.18.1 and started having issues with the File Upload component. I get TypeError: Cannot convert undefined or null to object when attempting to upload a file. Downgrading back to 4.17.2 allows file upload to work as expected.

The change might stem from commit or a similar one that loops through data.headers: https://github.com/formio/formio.js/commit/01dd46a3aa65de2bf623742e927e1215ee7b9e79. My data object doesn't have a key of headers as seen in the screenshot below. Stacktrace is also in the screenshot.

formio_js_s3_typeError

I also tried 4.17.4 and 4.17.5 and they also had the data.headers iteration code which gave me the TypeError. Perhaps I'm doing something wrong though...any advice is appreciated.

brendanbond commented 5 months ago

Yeah, we really need a conditional there - I believe this was a change to adopt to new behavior from the AWS SDK v3 (which changed the way it presigns URLs) but we didn't account for how this may break existing implementations. I'll see if I can file a simple PR which will check for the headers object here, which should fix the issue.

brendanbond commented 5 months ago

5476 should fix this, sorry for the inconvenience