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

NotFoundError doesn't log onAfterResponse #19

Open
bogeychan opened this issue Jul 12, 2024 · 4 comments
Open

NotFoundError doesn't log onAfterResponse #19

bogeychan opened this issue Jul 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@bogeychan
Copy link
Owner

bogeychan commented Jul 12, 2024

What versions are running?

{
    "dependencies": {
        "elysia": "1.1.3",
        "@bogeychan/elysia-logger": "0.1.1"
    }
}

What steps can reproduce the bug?

import { Elysia } from "elysia";
import { logger } from "@bogeychan/elysia-logger";

new Elysia()
  .use(logger())
  .get("/", () => "yay")
  .listen(8080);

Open http://localhost:8080/notFound in your browser

What is the expected behavior?

having 2 log entries in console

What do you see instead?

only 1

Additional information

blocked by elysiajs/elysia#713

@bogeychan bogeychan added the bug Something isn't working label Jul 12, 2024
@omarkhatibco
Copy link

I think you need Elysia v1.1

@bogeychan
Copy link
Owner Author

@omarkhatibco, I already tried it on elysia 1.1.3 but it doesn't work:

expect(stream.messages.length).toBe(1); // TODO: should be 2 but onAfterResponse skipped

@bogeychan bogeychan changed the title NotFoundError doesn't log onResponse NotFoundError doesn't log onAfterResponse Jul 19, 2024
@omarkhatibco
Copy link

@bogeychan my bad, I just noticed you are the author 🙈

I saw you updating the logger 2 days ago and thought to helping you with this issue, did not know it's you

but thank you for the logger

@bogeychan
Copy link
Owner Author

all good, I sometimes forget stuff too 😅

There is an issue on elysia's side blocking the progress of this issue (it is mentioned under additional information).

If you need this second 'not found’ log entry, use new Elysia({ aot: false }) as a workaround.

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

2 participants