{"action":"created","issue":{"url":"https://api.github.com/repos/nodemailer/mailcomposer/issues/74","repository_url":"https://api.github.com/repos/nodemailer/mailcomposer","labels_url":"https://api.github.com/repos/nodemailer/mailcomposer/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/nodemailer/mailcomposer/issues/74/comments","events_url":"https://api.github.com/repos/nodemailer/mailcomposer/issues/74/events","html_url":"https://github.com/nodemailer/mailcomposer/issues/74","id":184343758,"number":74,"title":"PDF attachments corrupted when running on Heroku","user":{"login":"realyze","id":596749,"avatar_url":"https://avatars.githubusercontent.com/u/596749?v=3","gravatar_id":"","url":"https://api.github.com/users/realyze","html_url":"https://github.com/realyze","followers_url":"https://api.github.com/users/realyze/followers","following_url":"https://api.github.com/users/realyze/following{/other_user}","gists_url":"https://api.github.com/users/realyze/gists{/gist_id}","starred_url":"https://api.github.com/users/realyze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realyze/subscriptions","organizations_url":"https://api.github.com/users/realyze/orgs","repos_url":"https://api.github.com/users/realyze/repos","events_url":"https://api.github.com/users/realyze/events{/privacy}","received_events_url":"https://api.github.com/users/realyze/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-20T21:20:54Z","updated_at":"2016-10-21T04:17:22Z","closed_at":null,"body":"My app runs on Heroku and I'm using `mail.createReadStream()` and `request` (it's meteor package https://github.com/froatsnook/meteor-request) to stream emails to Gmail API.\r\n\r\nThis is the code that sends the message:\r\n```\r\nconst response = request.postSync('https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=media', {\r\n  headers: _.extend({}, headers, {'Content-Type': 'message/rfc822'}),\r\n  body: mail.createReadStream()\r\n});\r\n```\r\n\r\nGmail returns HTTP 200 but the uploaded PDF almost always gets corrupted (and it's size is smaller than it should be). Images seem to get through fine, only PDFs get broken.\r\n\r\nThe funny thing is that I can't reproduce the corruption on localhost, just Heroku.\r\n\r\nAnd last bit - if I use `mail.build` and upload a string instead of streaming the payload, it works fine (PDF have right size)."},"comment":{"url":"https://api.github.com/repos/nodemailer/mailcomposer/issues/comments/255289933","html_url":"https://github.com/nodemailer/mailcomposer/issues/74#issuecomment-255289933","issue_url":"https://api.github.com/repos/nodemailer/mailcomposer/issues/74","id":255289933,"user":{"login":"realyze","id":596749,"avatar_url":"https://avatars.githubusercontent.com/u/596749?v=3","gravatar_id":"","url":"https://api.github.com/users/realyze","html_url":"https://github.com/realyze","followers_url":"https://api.github.com/users/realyze/followers","following_url":"https://api.github.com/users/realyze/following{/other_user}","gists_url":"https://api.github.com/users/realyze/gists{/gist_id}","starred_url":"https://api.github.com/users/realyze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realyze/subscriptions","organizations_url":"https://api.github.com/users/realyze/orgs","repos_url":"https://api.github.com/users/realyze/repos","events_url":"https://api.github.com/users/realyze/events{/privacy}","received_events_url":"https://api.github.com/users/realyze/received_events","type":"User","site_admin":false},"created_at":"2016-10-21T04:17:22Z","updated_at":"2016-10-21T04:17:22Z","body":"Hmm, the relevant part of the messages looks like this:\r\n```\r\n--001a114d71709f60de053f523f7d--\r\n--001a114d71709f60e4053f523f7f\r\nContent-Type: application/pdf; name=\"Starter Kit Book Report Outline 2012.pdf\"\r\nContent-Disposition: attachment; filename=\"Starter Kit Book Report Outline 2012.pdf\"\r\nContent-Transfer-Encoding: base64\r\nX-Attachment-Id: a8ef40d16031fbe8_0.1\r\n\r\n\r\n--001a114d71709f60e4053f523f7f--\r\n```\r\n\r\nThe boundary markers and the `X-Attachment-Id` are different but that's expected.\r\n\r\nIt almost looks like as if the attachment stream got terminated early for some reason but didn't report an error? FWIW, the attachments are stored on FileStack (they used to be called FilePicker).\r\n\r\nI wonder why if the difference could be that I'm running it locally on a Mac whereas Heroku is Linux... (sadly, I don't have a linux VM to play with at this time and most probably won't find time to look into this this week)."}}
{"actor":{"display_login":"realyze"}}