Setting session before login throws `Error: Can’t set headers after they are sent`
I need to have `sessionId` even before user logs in, to tracks browsing session of user and tie him to it later when he logs in, so I did this:

```
server.use(async (ctx, next) => {
  if (!ctx.session.sessionId) {
    ctx.session.sessionId = uuid.v4();
  }
  await next();
});
```

however if I do this I get (despite session id saving no problem)

```
{ Error: Can't set headers after they are sent.
    at validateHeader (_http_outgoing.js:504:11)
    at ServerResponse.setHeader (_http_outgoing.js:511:3)
    at Cookies.set (/Users/yuri/Sites/bridebook/Bridebook-next/node_modules/cookies/index.js:115:13)
    at ContextSession.save (/Users/yuri/Sites/bridebook/Bridebook-next/node_modules/koa-session/lib/context.js:276:22)
    at ContextSession.commit (/Users/yuri/Sites/bridebook/Bridebook-next/node_modules/koa-session/lib/context.js:220:16)
    at session (/Users/yuri/Sites/bridebook/Bridebook-next/node_modules/koa-session/index.js:46:18)
    at <anonymous> headerSent: true }

```

Any idea what I am doing wrong?