Skip to content

Application errors are not logging, only generating Boom "Internal Server Error" logs #4475

Open
@geuis

Description

@geuis

Runtime

node

Runtime version

21.1

Module version

huh?

Used with

hapi 21.3.2

Any other relevant information

No response

How can we help?

Ran into an issue where errors generated by application code are having their errors suppressed run in debug mode locally.

I have a route that is generating an error. When running locally, I'm just getting Boom internal server errors and not getting the actual error log messages.

I have the route wrapped in a try/catch and I can console.error the full logs in the catch, but I feel like there should be a global routes setting somewhere like debug that will just dump all errors like this to the console without needing special handling each time.

Note that failAction below does not get triggered either.

I've read up on debug https://hapi.dev/api/?v=21.3.2#-serveroptionsdebug though maybe I'm missing something?

My current server config:

  const server = Hapi.server({
    port: 2000,
    host: '0.0.0.0',
    routes: {
      validate: {
        failAction: async (req, h, err) => {
          console.error(err);
          throw err;
        }
      }
    },
    debug: {
      log: ['*'],
      request: ['*']
    },
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportQuestions, discussions, and general support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions