Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update to Node 10-alpine - ERR_STREAM_CANNOT_PIPE #29690

Closed
sashberd opened this issue Sep 24, 2019 · 5 comments
Closed

After update to Node 10-alpine - ERR_STREAM_CANNOT_PIPE #29690

sashberd opened this issue Sep 24, 2019 · 5 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@sashberd
Copy link

sashberd commented Sep 24, 2019

After I updated our server node JS to Node 10-alpine version I started to get next error

Error [ERR_STREAM_CANNOT_PIPE]: Cannot pipe, not readable.

I have to mention that with node 8-alpine this code is working (I tried with rollback)

In my code I am trying to return file from GCloud:

try {
        const file = await 
         gcs.bucket(`BUCKET_NAME`).file(filePath);

        if (file) {
            const results = await file.getMetadata();
            const stream = await file.createReadStream();
            return res.pipe(stream);
            else {
                return send(res, 403)
            }
        }
        else {
            return send(res, 404);
        }
    } catch (err) {
        console.error(err);
        return send(res, 500);
    }

Is any one met such issue after upgrade to node -10 -alpine?

@gireeshpunathil
Copy link
Member

@sashberd - yes, piping of outgoing message (in this case res.pipe) is inhibited through #14358, and this change is in effect from Node 10.

Hope this helps.

@sashberd
Copy link
Author

@gireeshpunathil Thanks. May be you know workaround?

@gireeshpunathil
Copy link
Member

yes - stream.pipe(res) - !!!

@gireeshpunathil
Copy link
Member

in this context, the correct definition of pipe is: connect the receiver object's read descriptor into the input object's write descriptor, not vice versa. receiver object is the file stream, and the input object is the server response, a Writablestream.

@targos targos added the stream Issues and PRs related to the stream subsystem. label Dec 26, 2020
@targos
Copy link
Member

targos commented Dec 26, 2020

This seems to have been answered.

@targos targos closed this as completed Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants