Menu

1 / 2

Inngest's instanceof lies: why custom error classes vanish across step.run

DEV Community·Art L·6 months ago
#zz2kW8zP
#inngest#typescript#webdev#javascript#error
Reading 0:00
15s threshold

A small bug that will silently break your retry logic, your error reporting, and your dashboards.

We run a long pipeline through Inngest — voice generation that calls OpenAI, then ElevenLabs, then writes to storage, with a consent gate at the top. Each vendor call lives in its own step.run so a transient failure on one vendor doesn't replay the rest of the pipeline.

We classify failures with custom error classes:

export class TTSUpstreamError extends Error { constructor ( public status : number , message : string ) { super ( message ); this . name = " TTSUpstreamError " ; } } And the failure handler did the obvious thing :

function ttsReasonFor ( err : unknown ): string { if ( err instanceof TTSUpstreamError ) return `elevenlabs_upstream: ${ err . status } ` ; if ( err instanceof TTSNotConfiguredError ) return " elevenlabs_not_configured " ; return " elevenlabs_unknown " ; }

Enter fullscreen mode

Exit fullscreen mode

Worked in dev. Worked in tests.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.