js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

formData.set is not a function on the ipfs-http-client lib

Open BankNatthapon opened this issue 5 years ago • 3 comments

  • Version: 54.0.0 from yarn add ipfs-http-client

  • Platform:

  • M1 Big Sur with 11.6 version

  • ReactJS with 17.0.2 version

  • Chrome (Official Build) (arm64) with 95.0.4638.69 version

Severity: High

Description:

  • What you did: I just want to learn how the client upload the image into the ipfs and I used the ReactJS framework with ipfs-http-client library
  • What happened: An error has occurred when I am using the ipfs.add() function with formData.set is not a function in the multipart-request.browser.js file
  • What you expected to happen: I just wonder why this error has occurred? and I struggle with this error for a while and try to change formData.set to formData.append function, it works! Hence, can you look into this error for inspecting the root cause and providing detail about it?

Steps to reproduce the error:

This is an error on the google chrome console:

alt text

This is the code in ipfs-http-client lib at multipart-request.browser.js file that made this error

alt text

This is my implementation code and it's working now after I changed formData.set to formData.append

alt text

Thanks in advance!

BankNatthapon avatar Nov 13 '21 20:11 BankNatthapon

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

welcome[bot] avatar Nov 13 '21 20:11 welcome[bot]

@BankNatthapon what bundler setup are you using for building your app? Both set and append are in the same spec and supported since Chrome 50: https://developer.mozilla.org/en-US/docs/Web/API/FormData#browser_compatibility

Perhaps you have some custom browser-compatibility setup as part of your build pipeline?

lidel avatar Nov 26 '21 15:11 lidel

Assuming no longer an issue? Feel free to fill new one or ask on discuss forums.

lidel avatar Jan 14 '22 15:01 lidel