{"action":"closed","issue":{"url":"https://api.github.com/repos/sendgrid/sendgrid-nodejs/issues/626","repository_url":"https://api.github.com/repos/sendgrid/sendgrid-nodejs","labels_url":"https://api.github.com/repos/sendgrid/sendgrid-nodejs/issues/626/labels{/name}","comments_url":"https://api.github.com/repos/sendgrid/sendgrid-nodejs/issues/626/comments","events_url":"https://api.github.com/repos/sendgrid/sendgrid-nodejs/issues/626/events","html_url":"https://github.com/sendgrid/sendgrid-nodejs/issues/626","id":275821459,"number":626,"title":"When receiving a 401 response cannot save error as json","user":{"login":"warnero","id":94818,"avatar_url":"https://avatars0.githubusercontent.com/u/94818?v=4","gravatar_id":"","url":"https://api.github.com/users/warnero","html_url":"https://github.com/warnero","followers_url":"https://api.github.com/users/warnero/followers","following_url":"https://api.github.com/users/warnero/following{/other_user}","gists_url":"https://api.github.com/users/warnero/gists{/gist_id}","starred_url":"https://api.github.com/users/warnero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warnero/subscriptions","organizations_url":"https://api.github.com/users/warnero/orgs","repos_url":"https://api.github.com/users/warnero/repos","events_url":"https://api.github.com/users/warnero/events{/privacy}","received_events_url":"https://api.github.com/users/warnero/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-11-21T18:51:50Z","updated_at":"2018-03-05T21:32:32Z","closed_at":"2018-03-05T21:32:32Z","author_association":"NONE","body":"#### Issue Summary\r\nIf I accidentally send the wrong api key I get back a 401. Unfortunately when I try and save this for logging purposes I get an error. (Note the string below is output from the \r\n```\r\nconsole.error('catching error', error.message, error.code, error.response);\r\n                    \r\n12:46:41 PM web.1 |  catching error Unauthorized 401 { headers:\r\n12:46:41 PM web.1 |     { server: 'nginx',\r\n12:46:41 PM web.1 |       date: 'Tue, 21 Nov 2017 18:46:39 GMT',\r\n12:46:41 PM web.1 |       'content-type': 'application/json',\r\n12:46:41 PM web.1 |       'content-length': '116',\r\n12:46:41 PM web.1 |       connection: 'close',\r\n12:46:41 PM web.1 |       'access-control-allow-origin': 'https://sendgrid.api-docs.io',\r\n12:46:41 PM web.1 |       'access-control-allow-methods': 'POST',\r\n12:46:41 PM web.1 |       'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl',\r\n12:46:41 PM web.1 |       'access-control-max-age': '600',\r\n12:46:41 PM web.1 |       'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html' },\r\n12:46:41 PM web.1 |    body: undefined }\r\n12:46:41 PM web.1 |  error sending email TypeError: Cannot read property 'errors' of undefined\r\n12:46:41 PM web.1 |      at ResponseError.toString (/Users/warner/code/goto10/paperless-web/node_modules/@sendgrid/helpers/classes/response-error.js:45:27)\r\n```\r\n\r\n\r\n#### Steps to Reproduce\r\n\r\n1. Put in incorrect key\r\n2. Try and save response to json document\r\n3. Get error\r\n\r\nAny other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?\r\n\r\n#### Technical details:\r\n\r\n* sendgrid-nodejs Version: 6.1.4\r\n* Node.js Version: 6.11.5"}}
{"actor":{"display_login":"thinkingserious"}}