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

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

Open
hisamafahri opened this issue Jan 23, 2025 · 0 comments
Open

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

hisamafahri opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@hisamafahri
Copy link
Contributor

hisamafahri commented Jan 23, 2025

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

@hisamafahri hisamafahri added the bug Something isn't working label Jan 23, 2025
@hisamafahri hisamafahri changed the title .trace() never get invoked if aot=true .trace() never get invoked if aot=false Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant