vscode-sfdx-hardis icon indicating copy to clipboard operation
vscode-sfdx-hardis copied to clipboard

Issue exporting files with new extension version. Error: [ERR_STREAM_WRITE_AFTER_END]

Open arpit-beautifi opened this issue 1 year ago • 6 comments

Hello!

Thank you for the great app! We find it extremely useful to export files in bulk from our org.

When trying to export files from Opportunities today like usual, I am getting the error:

Bulk Query: SELECT ContentDocumentId,LinkedEntityId FROM ContentDocumentLink WHERE LinkedEntityId IN ('%%OPPIDs%%','006OJ00000...node:events:497
     throw er; // Unhandled 'error' event
     ^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
   at _write (node:internal/streams/writable:487:11)
   at Writable.write (node:internal/streams/writable:508:10)
   at DuplexifiedStream.ondata (node:internal/streams/readable:1007:22)
   at DuplexifiedStream.emit (node:events:519:28)
   at addChunk (node:internal/streams/readable:559:12)
   at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
   at Readable.push (node:internal/streams/readable:390:5)
   at DuplexifiedStream._readStream (%%USER%%\AppData\Local\sf\node_modules\@jsforce\jsforce-node\lib\util\stream.js:81:18)
   at PassThrough.<anonymous> (%%USER%%\AppData\Local\sf\node_modules\@jsforce\jsforce-node\lib\util\stream.js:64:18)  
   at PassThrough.emit (node:events:519:28)
   at emitReadable_ (node:internal/streams/readable:832:12)
   at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
Emitted 'error' event on PassThrough instance at:
   at PassThrough.onerror (node:internal/streams/readable:1026:14)
   at PassThrough.emit (node:events:519:28)
   at emitErrorNT (node:internal/streams/destroy:169:8)
   at emitErrorCloseNT (node:internal/streams/destroy:128:3)
   at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
 code: 'ERR_STREAM_WRITE_AFTER_END'
}

Node.js v20.17.0

I have replaced actual Ids and names with placeholders for confidentiality reasons.

Let me know if you need any more information!

Thank you in advance!

arpit-beautifi avatar Sep 26 '24 21:09 arpit-beautifi

@arpit-beautifi is it happening everytime, or is it just bad luck ? I'm not sure there is an error handling in case Bulk API does not reply for a while ^^

nvuillam avatar Sep 27 '24 07:09 nvuillam

@nvuillam Still happening! I have tried creating completely new SFDX projects, reinstalling the plugin, downgrading the version, etc. Nothing seems to be working.

arpit-beautifi avatar Sep 27 '24 16:09 arpit-beautifi

@arpit-beautifi you can use the downgrade workaround until I succeed to reproduce it :)

https://github.com/hardisgroupcom/sfdx-hardis/issues/809

nvuillam avatar Oct 03 '24 21:10 nvuillam

@arpit-beautifi do you still have the problem ?

All plugin dependencies have been upgraded.... who knows, maybe jsforce has been fixed ^^

nvuillam avatar Jan 21 '25 20:01 nvuillam

Hey @nvuillam I am trying to run exports currently on the most recent version and am hitting the mentioned error here. Will downgrade for the time being

reedwi avatar Jan 22 '25 13:01 reedwi

I don't succeed to reproduce the issue with latest version :(

Image

@arpit-beautifi @reedwi please can you run sf version --verbose --json and post the result here ?

nvuillam avatar Jan 28 '25 09:01 nvuillam

@arpit-beautifi @reedwi I published enhancements with more logs, please can you check again, using the new Files Export/Import Workbench ?

You can now also increase timeout

nvuillam avatar Sep 15 '25 08:09 nvuillam

@arpit-beautifi @reedwi the issues should be solved, please reopen an issue if you see errors again :)

nvuillam avatar Oct 11 '25 23:10 nvuillam