oak
oak copied to clipboard
UnexpectedEof - early eof
What can cause this error? Its not happening all the time, I'm not sure how to interpret it.
[uncaught application error]: UnexpectedEof - early eof at async Listener.accept (deno:ext/net/01_net.js:207:19) at async accept (https://deno.land/x/[email protected]/http_server_native.ts:166:38)
This is a pretty common "error" that occurs with some clients and HTTP/2. Oak doesn't presume to know if this is meaningful to the application or not, so applications without an error handler (app.addEventListener("error", handler)) will log them so that the implementors is aware that they occurring versus just being swallowed.
Generally speaking, they can be safely ignored, but if you had for example some logic around maintaining a DV connection per client (versus per request), you might want to do some cleanup when an error like this occurred.
I'm adding the error handler to try to gather more information, I'll either just close this or update with more details if there is more context worth sharing.
Oak shows the same error while deploying supabase edge functions. It just blocked all the routes.
Event message [uncaught application error]: UnexpectedEof - early eof

I tried adding an error listener, as suggested, but the early eof still gets logged. Is this correct:
app.addEventListener('error', (e) => {
const lowerMsg = e.error?.message?.toLowerCase();
if (lowerMsg?.includes('early eof')) { return }
console.error(e.error);
})
Same here... still seeing the error on deno deploy. Also added a listener, no luck!
Hello. I believe setting logErrors: false will prevent the default log. You might want to still handle other errors with the code provided in SkepticMystics comment above.
new Application({ logErrors: false });
This is effectively answered in the FAQs under: https://oakserver.github.io/oak/FAQ#i-am-seeing-uncaught-application-error-in-the-output-what-is-going-on