oak icon indicating copy to clipboard operation
oak copied to clipboard

UnexpectedEof - early eof

Open justinmchase opened this issue 3 years ago • 3 comments

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)

justinmchase avatar Mar 06 '22 20:03 justinmchase

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.

kitsonk avatar Mar 07 '22 01:03 kitsonk

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.

justinmchase avatar Mar 07 '22 13:03 justinmchase

Oak shows the same error while deploying supabase edge functions. It just blocked all the routes.

Event message [uncaught application error]: UnexpectedEof - early eof

image

bidyut18 avatar Sep 05 '22 14:09 bidyut18

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);
})

SkepticMystic avatar Oct 13 '22 08:10 SkepticMystic

Same here... still seeing the error on deno deploy. Also added a listener, no luck!

fcavalcantirj avatar Nov 27 '22 15:11 fcavalcantirj

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 });

rossholdway avatar Dec 20 '22 16:12 rossholdway

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

kitsonk avatar Apr 25 '23 05:04 kitsonk