{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1097","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1097/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1097/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1097/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/issues/1097","id":129761101,"number":1097,"title":"Cloud Storage not persisting on error","user":{"login":"techniq","id":177476,"avatar_url":"https://avatars.githubusercontent.com/u/177476?v=3","gravatar_id":"","url":"https://api.github.com/users/techniq","html_url":"https://github.com/techniq","followers_url":"https://api.github.com/users/techniq/followers","following_url":"https://api.github.com/users/techniq/following{/other_user}","gists_url":"https://api.github.com/users/techniq/gists{/gist_id}","starred_url":"https://api.github.com/users/techniq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techniq/subscriptions","organizations_url":"https://api.github.com/users/techniq/orgs","repos_url":"https://api.github.com/users/techniq/repos","events_url":"https://api.github.com/users/techniq/events{/privacy}","received_events_url":"https://api.github.com/users/techniq/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/question","name":"question","color":"cc317c"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/storage","name":"storage","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":28,"created_at":"2016-01-29T13:05:47Z","updated_at":"2016-02-02T17:02:26Z","closed_at":"2016-02-01T13:46:28Z","body":"I've ran into an issue that is only present in production using the Google Cloud Storage API.  I have an importer that loads 100 entries at a time.  When developing locally (with `require('fs')`) and an error occurs on say page 5, the previous pages worth of entries (400 total) are still persisted to disk.  When using GCS, this is not the case (the file doesn't even appear in the bucket).\r\n\r\nHere is a snippet of the problematic part of the pipeline.\r\n```js\r\n    stream = importer.streamPages({perPage: perPage, importDate: importDate}, maxPages);\r\n    \r\n    let writeStream = null;\r\n    if (process.env.NODE_ENV === 'production') {\r\n      writeStream = bucket.file(importFileName).createWriteStream();\r\n    } else {\r\n      writeStream = fs.createWriteStream(`data/${importFileName}`);\r\n    } \r\n    \r\n    stream\r\n      .on('error', err => this.logError(err))\r\n      .pipe(ndjson.stringify())\r\n      .pipe(writeStream);\r\n```"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/178688976","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/issues/1097#issuecomment-178688976","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1097","id":178688976,"user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T17:02:26Z","updated_at":"2016-02-02T17:02:26Z","body":"Could you plop a gist or repo together with the bare minimums so I can jump in? (please include package.json!) I think we can figure it out, but I'm doing a lot of scrolling back and forth, so I think I'm probably just slowing us both down."}}