question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Form Data with Blobs - TypeError: source.on is not a function

See original GitHub issue

Adding a blob to form data produces the following error:

node . -x none https://childlike-serpent.glitch.me/

A-Frame Version: 0.8.0 (Date 2018-03-11, Commit #82934b02)
three Version: github:dmarcos/three.js#r90fixPose
WebVR Polyfill Version: ^0.9.40
THREE.WebGLRenderer 90
THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.
THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.
TypeError: source.on is not a function
    at Function.DelayedStream.create (C:\workspace\expanse-app\exokit\node_modules\delayed-stream\lib\delayed_stream.js:33:10)
    at FormData.CombinedStream.append (C:\workspace\expanse-app\exokit\node_modules\combined-stream\lib\combined_stream.js:44:37)
    at FormData.append (C:\workspace\expanse-app\exokit\node_modules\form-data\lib\form_data.js:74:3)
    at https://childlike-serpent.glitch.me/:16:14
    at Object._runJavascript (C:\workspace\expanse-app\exokit\src\utils.js:67:15)
    at Resource.ownerDocument.resources.addResource [as getCb] (C:\workspace\expanse-app\exokit\src\DOM.js:1639:13)
    at Promise (C:\workspace\expanse-app\exokit\src\core.js:92:12)
    at new Promise (<anonymous>)
    at Resource.get (C:\workspace\expanse-app\exokit\src\core.js:91:12)
    at Resources.drain (C:\workspace\expanse-app\exokit\src\core.js:170:16)
    at Promise (C:\workspace\expanse-app\exokit\src\core.js:163:12)
    at new Promise (<anonymous>)
    at Resources.addResource (C:\workspace\expanse-app\exokit\src\core.js:143:12)
    at HTMLScriptElement.runNow (C:\workspace\expanse-app\exokit\src\DOM.js:1638:41)
    at HTMLScriptElement.<anonymous> (C:\workspace\expanse-app\exokit\src\DOM.js:1655:21)
    at C:\workspace\expanse-app\exokit\src\Document.js:120:17
    at Document._addRun (C:\workspace\expanse-app\exokit\src\Document.js:134:7)
    at element.traverse.el (C:\workspace\expanse-app\exokit\src\core.js:664:41)
    at _recurse (C:\workspace\expanse-app\exokit\src\DOM.js:1118:22)
    at _recurse (C:\workspace\expanse-app\exokit\src\DOM.js:1124:28)
    at HTMLBodyElement.traverse (C:\workspace\expanse-app\exokit\src\DOM.js:1135:12)
    at Promise (C:\workspace\expanse-app\exokit\src\core.js:657:15)
    at new Promise (<anonymous>)
    at Object._runHtml (C:\workspace\expanse-app\exokit\src\core.js:654:12)
    at process.nextTick (C:\workspace\expanse-app\exokit\src\Document.js:176:29)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Not sure if this one is in the scope. I could work around by posting strings instead of files/blobs.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
avaercommented, Dec 10, 2018

Yeah I think it should be solved by https://github.com/webmixedreality/exokit/pull/628. It was a Buffer identity check that elided a length set.

0reactions
sidequestlegendcommented, Dec 10, 2018

Sorry i missed this somhow, so the blob size would have been pretty small but could get large. The one i was testing with would have been kilobytes.

I had thought it was the below failing too.

Buffer.isBuffer(value)

so i tried

Buffer.isBuffer(value.buffer) // The blob has a buffer inside

but it didnt work. I got the data but it was always truncated. I could not figure out why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appending Blob To Form Data Throws TypeError: source.on is ...
This seems like something further down the chain, maybe where the form is being consumed? It looks like something is expecting a stream,...
Read more >
TypeError: source.on is not a function · Issue #2366 - GitHub
I'm trying to POST an array of values to a HTTP endpoint, and this is the error I receive: TypeError: source.on is not...
Read more >
FormData.append() - Web APIs | MDN
The append() method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key...
Read more >
formdata-node - npm
Spec-compliant FormData implementation for Node.js. Latest version: 5.0.0, last published: 4 months ago. Start using formdata-node in your ...
Read more >
Can't upload a file from node.js to my route, getting empty ...
function uploadScreenshot() { let formData = new FormData() let stream = fs. ... as obviously it is not reading the correct file that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found