hapijs / hapijs/hapi

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

Open
#4,475 2 comments 1 reaction 0 assignees View on GitHub
support
Dominant language
JavaScript
Stars
14.8k
Forks
1.4k
Avg merge
22d 3h
Merged PRs (30d)
1

Description

### 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: ['*']
},
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.