feathers icon indicating copy to clipboard operation
feathers copied to clipboard

`app` property missing on setup hook

Open Catatomik opened this issue 1 year ago • 0 comments

Steps to reproduce

  • [ ] app property is missing from the HookContext of any application setup hook.

Example :

import { MongoClient } from 'mongodb'

app.hooks({
  setup: [
    async (context: HookContext, next: NextFunction) => {
      const mongodb = new MongoClient(yourConnectionURI)

      await mongodb.connect()
      context.app.set('mongodb', mongodb)
      await next()
    }
  ]
})

Taken directly from featherjs's Dove docs. context.app is undefined here.

Expected behavior

There should be an app property on setup's HookContext.

Actual behavior

There is no app property on setup's HookContext.

System configuration

Module versions (especially the part that's not working): every @feathersjs libs version 5.0.0-pre.28

NodeJS version: 17.3.0

Catatomik avatar Aug 08 '22 15:08 Catatomik

Very strange. It is being tested in https://github.com/feathersjs/feathers/blob/dove/packages/feathers/test/hooks/app.test.ts#L57-L92 but I can confirm that it isn't showing up in a wrapped application.

daffl avatar Aug 10 '22 14:08 daffl