Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async function constructor name not AsyncFunction #873

Closed
2 of 4 tasks
wangkunmeng opened this issue Jun 19, 2023 · 1 comment
Closed
2 of 4 tasks

async function constructor name not AsyncFunction #873

wangkunmeng opened this issue Jun 19, 2023 · 1 comment

Comments

@wangkunmeng
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

listenerFunction

    @OnEvent(TicketEventEnum.UPDATE, { async: true })
    async test() {
        console.error('test');
    }

eventemitter2

eventemitter.js

        if (promisify === undefined) {
          promisify = listener.constructor.name === 'AsyncFunction';
        }

the result

promisify is false。listener is ticket.update (...args) => instance[methodKey].call(instance, ...args)
the .constructor.name === 'Function';

the problem reason

https://github.com/nestjs/event-emitter/blob/master/lib/event-subscribers.loader.ts#L95

this can cause emitAsync.catch not working !

Minimum reproduction code

https://github.com/nestjs/event-emitter/blob/master/lib/event-subscribers.loader.ts#L95

Steps to reproduce

No response

Expected behavior

listener constructor name is AsyncFunction

Package version

9.4

NestJS version

9.4

Node.js version

16

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@wangkunmeng wangkunmeng added bug Something isn't working needs triage labels Jun 19, 2023
@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

@kamilmysliwiec kamilmysliwiec added needs clarification and removed bug Something isn't working needs triage labels Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants