Await on findOne returns not found (404) all the time

Solution 1:

You don't export anything from your router-file. In order to use

app
.use(TrustRoutes.routes())
.use(TrustRoutes.allowedMethods());

you need to export the koa-router from the TrustRoutes-file:

const router = new Router({
    prefix: '/trust'
});

router.get('/:trustId', async (ctx,next) => {
    // ...
});

module.exports = router;

Apart from this when using async handlers, you need to either return next or await (see https://github.com/ZijianHe/koa-router/issues/476):

router.get('/:trustId', async (ctx,next) => {
        // ...
    return next(); // or await next();
});

Solution 2:

I missed to have return next() in auth js the middleware. After updating it next(); to return next() it works.

const verifyToken = async (ctx, next) => {
    .....
    return next();
};