I have a koa middleware that I am using like this:
.use(signS3())
What I want to do now is use the ctx object from koa in the config object from signS3(). I would like to do something like this:
.use((ctx, next) => signS3({ keyPrefix: ctx.host })(ctx, next))
But this doesn't work. I am thinking I have the syntax wrong, would appreciate any input on how to do this.
You are using middleware written for
koa@1which uses generators instead ofasync/await. You should have noticed this warning when running your application:In order to use this middleware in
koa@2you need to convert it, manually or using koa-convert. For example:Also take a look at official documentation about Using v1.x Middleware in v2.x