Skip to content

[bug] Unable to use evlog in nuxt server middleware #210

@michaelreinhard1

Description

@michaelreinhard1

Description

Hey, I’m running into an issue where I can't seem to use evlog inside a server middleware. It throws the following error:

[evlog] Logger not initialized. Make sure the evlog Nitro plugin is registered. If using Nuxt, add "evlog" to your modules.

It works fine on api routes but fails in middleware

Image Image

This is what the evlog AI said:

Image

Thank you! :)

Reproduction

To reproduce this just create a Nuxt server middleware and try to log with evlog

example snippet:

export default defineEventHandler(async (event) => {
  const logger = useLogger(event, "test");
  
  logger.set({ user: { id: "test", plan: "enterprise" } }) ;
});

Logs

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions