formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

danman01 opened this issue · comments

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: 01dd46a. 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.

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.

#5476 should fix this, sorry for the inconvenience