You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.
Currently the new retry plugin is incompatible with pipes. If one tries to upload/download an attachment with pipe and has enabled the retry plugin, it generates an error:
TypeError: Cannot read property 'pipe' of undefined
and
/Users/fred/dev/whisk/openwhisk-darkvisionapp/web/node_modules/cloudant/plugins/retry.js:58
callback(results[0], results[1], results[2])
^
TypeError: callback is not a function
at /Users/fred/dev/whisk/openwhisk-darkvisionapp/web/node_modules/cloudant/plugins/retry.js:58:7
at /Users/fred/dev/whisk/openwhisk-darkvisionapp/web/node_modules/cloudant/node_modules/async/dist/async.js:988:16
The retry plugin should adapt or there should be a way to bypass the retry plugin when calling get/insert for attachments.
My current solution is to have two cloudant objects, one where retry is enabled, one without used only to deal with attachments. Specially in the case of an upload I don't want to load the attachment in memory to send it to cloudant but rather I want to stream it from the disk to cloudant.
The text was updated successfully, but these errors were encountered:
You are correct. With the default plugin, when you call a cloudant library function you are returned the request object that is responsible for making the request. This allows you to stream the reply using the Node.js streams API or pipe it to an output stream.
When using the retry plugin, we cannot asynchronously return the request that does the work because it might not be the first request.
The work-around you suggested is the same recommendation I gave in this blog.
Your attachment work-around is fine, but there are other cases when it is desirable to stream the data e.g. downloading large cuts of data.
glynnbird
added a commit
to glynnbird/nodejs-cloudant
that referenced
this issue
Nov 4, 2016
Currently the new retry plugin is incompatible with pipes. If one tries to upload/download an attachment with pipe and has enabled the retry plugin, it generates an error:
and
The retry plugin should adapt or there should be a way to bypass the retry plugin when calling get/insert for attachments.
My current solution is to have two cloudant objects, one where retry is enabled, one without used only to deal with attachments. Specially in the case of an upload I don't want to load the attachment in memory to send it to cloudant but rather I want to stream it from the disk to cloudant.
The text was updated successfully, but these errors were encountered: