{"action":"created","issue":{"url":"https://api.github.com/repos/krakenjs/kraken-js/issues/429","labels_url":"https://api.github.com/repos/krakenjs/kraken-js/issues/429/labels{/name}","comments_url":"https://api.github.com/repos/krakenjs/kraken-js/issues/429/comments","events_url":"https://api.github.com/repos/krakenjs/kraken-js/issues/429/events","html_url":"https://github.com/krakenjs/kraken-js/issues/429","id":115120689,"number":429,"title":"app.render silent fail","user":{"login":"rhettl","id":1766765,"avatar_url":"https://avatars.githubusercontent.com/u/1766765?v=3","gravatar_id":"","url":"https://api.github.com/users/rhettl","html_url":"https://github.com/rhettl","followers_url":"https://api.github.com/users/rhettl/followers","following_url":"https://api.github.com/users/rhettl/following{/other_user}","gists_url":"https://api.github.com/users/rhettl/gists{/gist_id}","starred_url":"https://api.github.com/users/rhettl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhettl/subscriptions","organizations_url":"https://api.github.com/users/rhettl/orgs","repos_url":"https://api.github.com/users/rhettl/repos","events_url":"https://api.github.com/users/rhettl/events{/privacy}","received_events_url":"https://api.github.com/users/rhettl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2015-11-04T18:45:20Z","updated_at":"2015-11-11T16:24:51Z","closed_at":null,"body":"Hello, This issue is very similar to #354, but I didn't want to force that re-opened. \r\n\r\nI am running into an issue that `app.render` silent fails. \r\n\r\nThe website I am writing is sending reminder emails 14 days and 2 days before scheduled events. So the emails are being triggered by setTimeout and there is not `Response` object from which to copy `res.locals`.\r\n\r\nI have tried adding `_locals`, `contentLocals`, `context.locals`, and `_locals.context.localities` properties to my data object to send my default 'en-US' locality to dust/makara, but with no success. I have even traced to see dust-makara-helpers check for the right variables in `localeFromContext` to return my 'en-US' locality to the loader function, but somewhere there after it still fails and I cannot see where.\r\n\r\nHere is my email module\r\n```javascript\r\nvar extend = require('extend');\r\nvar nodemailer = require('nodemailer');\r\nvar sendmailTransport = require('nodemailer-sendmail-transport');\r\n\r\nvar baseDefaults = {};\r\nvar baseTemplateDefaults = {\r\n  //_locals: {\r\n  //  contentLocale: {\r\n  //    locale: 'en-US'\r\n  //  }\r\n  //}\r\n};\r\n\r\nmodule.exports = {\r\n  __render: null,\r\n  __app: null,\r\n  __defaults: {},\r\n  __templateDefaults: {},\r\n  /**\r\n   * Setup MailTransport with nodemailer\r\n   * @param app  {object} kraken/express application\r\n   * @param conf {object} mailtransport configuration settings from config.js\r\n   */\r\n  config: function (app, conf) {\r\n    if (!app || !app.render) {\r\n      throw new Error('There is no render function. Please fix it. Fix it, fix it now!');\r\n    }\r\n    if (!conf || !conf.name || !module.exports['__'+conf.name]) {\r\n      throw new Error('No transport has been named or named transport doesn\\'t exist.');\r\n    }\r\n\r\n    module.exports.__app = app;\r\n    module.exports.__render = app.render.bind(app);\r\n    module.exports.__transport = module.exports['__' + conf.name](conf.options);\r\n    module.exports.__defaults = extend({}, baseDefaults, conf.defaults);\r\n    module.exports.__templateDefaults = extend({}, baseTemplateDefaults, conf.templateDefaults);\r\n    console.log('Mail Transport Ready');\r\n  },\r\n\r\n  __sendmail: function(options){\r\n    return nodemailer.createTransport(sendmailTransport(options));\r\n  },\r\n\r\n\r\n  render: function(template, data, callback) {\r\n    if (typeof data === 'function') {\r\n      if (!callback) {\r\n        callback = data;\r\n        data = {};\r\n      } else if (typeof callback === 'function') {\r\n        //noinspection JSUnresolvedFunction\r\n        data = data() || {};\r\n      }\r\n    }\r\n\r\n    var tempData = extend({}, module.exports.__templateDefaults, data);\r\n\r\n    try{\r\n      module.exports.__render('emails/' + template, tempData, callback);\r\n    } catch (err) {\r\n      callback(err);\r\n    }\r\n   },\r\n\r\n  send: function(template, templateData, mailOptions, callback){\r\n    module.exports.render(template, templateData, function(err, html){\r\n      console.log('here I am');\r\n      if (err) {\r\n        return callback(err);\r\n      }\r\n\r\n      var optionsCombined = extend({html: html}, module.exports.__defaults, mailOptions);\r\n      //console.log(html, optionsCombined);\r\n\r\n\r\n      console.log(optionsCombined);\r\n      module.exports.__transport.sendMail(optionsCombined, callback || function(){});\r\n    });\r\n  }\r\n\r\n};\r\n```\r\n\r\nand a section of my `config.json` (with some minor modification of the personal information)\r\n```json\r\n{\r\n  \"mailtransport\": {\r\n    \"name\": \"sendmail\",\r\n    \"options\": {\r\n      \"path\": \"/usr/sbin/sendmail\",\r\n      \"args\": [\"-i\", \"-t\"]\r\n    },\r\n    \"defaults\": {\r\n      \"from\": \"Rhett <rhett@******.edu>\",\r\n      \"subject\": \"[*******] Interviews App\",\r\n      \"generateTextFromHTML\": true\r\n    },\r\n    \"templateDefaults\": {\r\n      \"domain\": \"******.edu:8000\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n\r\nThank you for any help you might be able to provide. I have been racking my brain on this for over a week."},"comment":{"url":"https://api.github.com/repos/krakenjs/kraken-js/issues/comments/155834506","html_url":"https://github.com/krakenjs/kraken-js/issues/429#issuecomment-155834506","issue_url":"https://api.github.com/repos/krakenjs/kraken-js/issues/429","id":155834506,"user":{"login":"aredridel","id":2876,"avatar_url":"https://avatars.githubusercontent.com/u/2876?v=3","gravatar_id":"","url":"https://api.github.com/users/aredridel","html_url":"https://github.com/aredridel","followers_url":"https://api.github.com/users/aredridel/followers","following_url":"https://api.github.com/users/aredridel/following{/other_user}","gists_url":"https://api.github.com/users/aredridel/gists{/gist_id}","starred_url":"https://api.github.com/users/aredridel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aredridel/subscriptions","organizations_url":"https://api.github.com/users/aredridel/orgs","repos_url":"https://api.github.com/users/aredridel/repos","events_url":"https://api.github.com/users/aredridel/events{/privacy}","received_events_url":"https://api.github.com/users/aredridel/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T16:24:51Z","updated_at":"2015-11-11T16:24:51Z","body":"Oh, yes, yes I did. I'd be happy to expose a cleaner initializer in makara for use where requests have not run yet. The way it's built is wacky 100% to appease Kraken and its config language which is limited in this case."}}