{"action":"closed","issue":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/510","labels_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/510/labels{/name}","comments_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/510/comments","events_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/510/events","html_url":"https://github.com/petkaantonov/bluebird/issues/510","id":58859313,"number":510,"title":"Return a promise from a custom function","user":{"login":"charyorde","id":160010,"avatar_url":"https://avatars.githubusercontent.com/u/160010?v=3","gravatar_id":"","url":"https://api.github.com/users/charyorde","html_url":"https://github.com/charyorde","followers_url":"https://api.github.com/users/charyorde/followers","following_url":"https://api.github.com/users/charyorde/following{/other_user}","gists_url":"https://api.github.com/users/charyorde/gists{/gist_id}","starred_url":"https://api.github.com/users/charyorde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charyorde/subscriptions","organizations_url":"https://api.github.com/users/charyorde/orgs","repos_url":"https://api.github.com/users/charyorde/repos","events_url":"https://api.github.com/users/charyorde/events{/privacy}","received_events_url":"https://api.github.com/users/charyorde/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-25T07:02:18Z","updated_at":"2015-02-25T07:39:16Z","closed_at":"2015-02-25T07:39:16Z","body":"Hi,\r\n\r\nCan you please show me how to return a promise from a custom function using bluebird? Here's what I'm working with:\r\n```\r\nvar session = require('express-session');\r\nvar RedisStore = require('connect-redis')(session);\r\nvar P = require('bluebird');\r\n\r\nvar redisSessionStore = new RedisStore({client: redisClient});\r\nP.promisifyAll(redisSessionStore);\r\n\r\nredisSessionStore.getAsync('active_session').then(function(data) {  \r\n    if(!data || (data.timestamp < Data.now())) {\r\n        return sulogin(params);\r\n    }\r\n}).then(function(values) { // expecting sulogin to return a promise\r\n  // do another async call\r\n});\r\n\r\nfunction sulogin(params){\r\n\r\n}\r\n```\r\nHow can I make sulogin return a promise?"}}