Skip to content

Warn users when failing to require preboot#54

Merged
rmarkins-godaddy merged 1 commit intogodaddy:mainfrom
epaez-godaddy:patch-1
Nov 20, 2025
Merged

Warn users when failing to require preboot#54
rmarkins-godaddy merged 1 commit intogodaddy:mainfrom
epaez-godaddy:patch-1

Conversation

@epaez-godaddy
Copy link
Contributor

@epaez-godaddy epaez-godaddy commented Nov 19, 2025

Problem

When you have an error in any of the preboots, middlewares or routes modules or any other file required by those modules the error will be omitted by the catch in lib/preboot/require.js.

Essentially, this means that any require or runtime error in any file that is used during application startup will be omitted and the application will start in an invalid state. For example, the application might start without registered routes or without essentials preboots.

Goal

The goal of this simple fix is to:

  • show developers errors in their startup code when they're working locally
  • don't change existing behavior so this can be safely distributed and adopted in a new patch version
  • show the error to as many devs as possible without expecting prior knowledge or changes on their end.

Considerations

  • I know using DEBUG=* would show this. However I don't consider this an alternative because:
    • Discoverability. I don't expect devs to randomly add DEBUG=* when debugging an issue. I have hardly used that myself.
    • Adding DEBUG=* dramatically increases the amount of console output not really helping troubleshoot unless you already know what you're looking for
    • Only way to filter the output would be to already know the problem is related to Slay
  • I know this might show up in logs and might be a bit hard to track there since it would not have metadata attached, however:
    • I don't expect this error to happen so much in production that this becomes a problem. If it is happening, the application running in an invalid state is probably going to be loud enough that devs need to figure it out anyway
    • This sounds like a small price to pay to make the error be visible by default and distributing as a patch version.
    • I though we could check NODE_ENV but I know there is a lot of variability in how that is filled for a 'local' env, so I think it's a nonstarter
  • I considered this the path of least resistance so this can be widely distributed and be useful to as many devs as possible without needing work on their end.

Hope this sounds reasonable. If not, I am happy to discuss alternatives or update the code 👍
I have been bitten SO MANY TIMES by errors being swallowed! I hope we can figure something out that makes sure no other dev needs to waste as much time as I have on this again

@epaez-godaddy epaez-godaddy marked this pull request as ready for review November 20, 2025 14:11
@epaez-godaddy epaez-godaddy requested a review from a team as a code owner November 20, 2025 14:11
@rmarkins-godaddy rmarkins-godaddy merged commit 05353b8 into godaddy:main Nov 20, 2025
3 checks passed
@epaez-godaddy epaez-godaddy deleted the patch-1 branch November 20, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants