Skip to content

.trace() never get invoked if aot=false #1027

Open
@hisamafahri

Description

@hisamafahri

What version of Elysia is running?

^1.2.10

What platform is your computer?

Darwin 24.3.0 arm64 arm

What steps can reproduce the bug?

  • In an elysia project, copy the following code (adjusted from Trace docs):
import { Elysia } from "elysia";

const app = new Elysia({ aot: false })
  .trace(async ({ onHandle }) => {
    onHandle(({ begin, onStop }) => {
      onStop(({ end }) => {
        console.log('handle took', end - begin, 'ms')
      })
    })
  })
  .get('/', () => 'Hi')
  .listen(3000)

console.log(
  `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);
  • Run the project, and call http://localhost:3000. The API itself should return HTTP 200.

What is the expected behavior?

It should display handle took xxms.

What do you see instead?

If using aot=false, the process doesn't log anything in the .trace() method (no console.log values displayed). But, on the other hand, usingaot=true, it works as intended.

Additional information

I highly suspects that this problem also impact (at least) the @elysiajs/opentelemetry, since it also utilizes the .trace() handler (see also: elysiajs/opentelemetry#11).

Have you try removing the node_modules and bun.lockb and try again yet?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions