Skip to content

Downloading from Cloud Storage - Cannot call method 'write' of null #789

Description

@kieranhackshall

I have a node instance that creates child processes, in these child processes there is a requirement to download a file from Cloud storage. When running more than one I am seeing the following error:

/opt/testing/node_modules/modesl/node_modules/eventemitter2/lib/eventemitter2.js:290
throw arguments[1]; // Unhandled 'error' event
^
TypeError: Cannot call method 'write' of null
at onCreated (/opt/testing/src/outbound/lib/Child.js:1153:62)
at DestroyableTransform. (/opt/testing/src/outbound/lib/Child.js:1463:17)
at DestroyableTransform.emit (events.js:117:20)
at /opt/testing/node_modules/gcloud/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js
:965:16
at process._tickCallback (node.js:448:13)

To download I have tried both examples shown in the gcloud-node repository:

// Download a file from your bucket.
bucket.file('giraffe.jpg').download({
destination: '/photos/zoo/giraffe.jpg'
}, function(err) {});

// Streams are also supported for reading and writing files.
var localReadStream = fs.createReadStream('/photos/zoo/zebra.jpg');
var remoteWriteStream = bucket.file('zebra.jpg').createWriteStream();
localReadStream.pipe(remoteWriteStream);

Has anyone else seen this issue, is it a bug?

Activity

  1. callmehiphop commented on Aug 10, 2015

    @callmehiphop
    Contributor

    Thanks for reporting this issue! I tested this locally but I wasn't able to trigger the same error, do you think you could provide us with a test case to recreate the issue?

  2. kieranhackshall commented on Aug 10, 2015

    @kieranhackshall
    Author

    Thanks for replying.

    I wrote a simpler test case and discovered the bug was occurring elsewhere in my code, the problem does not relate to gcloud-node, so am closing this issue.

  3. hu9o commented on Jan 26, 2017

    @hu9o

    I am curious as to why you were getting this error, I am completely at loss...
    I barely changed the sample code and encounter it seemingly randomly (albeit frequently).

  4. stephenplusplus commented on Jan 26, 2017

    @stephenplusplus
    Contributor

    @hu9o could you share a reproduction case / show your code? I'm happy to take a look.

  5. hu9o commented on Jan 27, 2017

    @hu9o

    Sorry, this is embarrassing: my error is actually about the speech API... I should have paid more attention.

  6. added a commit that references this issue on Jul 23, 2025
  7. 2 remaining items

  8. added a commit that references this issue on Feb 5, 2026
  9. added a commit that references this issue on Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions