{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/session/issues/570","repository_url":"https://api.github.com/repos/expressjs/session","labels_url":"https://api.github.com/repos/expressjs/session/issues/570/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/session/issues/570/comments","events_url":"https://api.github.com/repos/expressjs/session/issues/570/events","html_url":"https://github.com/expressjs/session/issues/570","id":308265080,"number":570,"title":"Session generation appears to be asynchronous","user":{"login":"Aman40","id":25874977,"avatar_url":"https://avatars1.githubusercontent.com/u/25874977?v=4","gravatar_id":"","url":"https://api.github.com/users/Aman40","html_url":"https://github.com/Aman40","followers_url":"https://api.github.com/users/Aman40/followers","following_url":"https://api.github.com/users/Aman40/following{/other_user}","gists_url":"https://api.github.com/users/Aman40/gists{/gist_id}","starred_url":"https://api.github.com/users/Aman40/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aman40/subscriptions","organizations_url":"https://api.github.com/users/Aman40/orgs","repos_url":"https://api.github.com/users/Aman40/repos","events_url":"https://api.github.com/users/Aman40/events{/privacy}","received_events_url":"https://api.github.com/users/Aman40/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-24T14:04:08Z","updated_at":"2018-03-24T14:05:50Z","closed_at":null,"author_association":"NONE","body":"Focus on the `send_session_data` function at the end. In the `else` part, without the `res.write(\"<msg>You're not logged in</msg>\");` statement, `${res.getHeader('Set-Cookie')}` returns `undefined`. The other way to get it to work is to use a `setTimeOut` function with even just a few milliseconds to provide overhead, or \"buy time\" for the session to be generated. Only then will the `${res.getHeader('Set-Cookie')}` statement contain the cookie. Now, I don't know if it's the default `genid` function, but something is asynchronous during the generation of the the session, yet it doesn't inherit the `eventEmitter` class. Did I miss something? Source file is attached. \r\n[proof.js.gz](https://github.com/expressjs/session/files/1844446/proof.js.gz)\r\n[proof.txt](https://github.com/expressjs/session/files/1844447/proof.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/expressjs/session/issues/comments/375891836","html_url":"https://github.com/expressjs/session/issues/570#issuecomment-375891836","issue_url":"https://api.github.com/repos/expressjs/session/issues/570","id":375891836,"user":{"login":"Aman40","id":25874977,"avatar_url":"https://avatars1.githubusercontent.com/u/25874977?v=4","gravatar_id":"","url":"https://api.github.com/users/Aman40","html_url":"https://github.com/Aman40","followers_url":"https://api.github.com/users/Aman40/followers","following_url":"https://api.github.com/users/Aman40/following{/other_user}","gists_url":"https://api.github.com/users/Aman40/gists{/gist_id}","starred_url":"https://api.github.com/users/Aman40/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aman40/subscriptions","organizations_url":"https://api.github.com/users/Aman40/orgs","repos_url":"https://api.github.com/users/Aman40/repos","events_url":"https://api.github.com/users/Aman40/events{/privacy}","received_events_url":"https://api.github.com/users/Aman40/received_events","type":"User","site_admin":false},"created_at":"2018-03-24T14:05:50Z","updated_at":"2018-03-24T14:05:50Z","author_association":"NONE","body":"PS: How do I add tags like \"need help\""}}
{"actor":{"display_login":"Aman40"}}