Skip to content

fix: replace TRPCClientError with more user-friendly msg#5347

Merged
TBonnin merged 1 commit intomasterfrom
tbonnin/jan30/trpcclienterror
Feb 12, 2026
Merged

fix: replace TRPCClientError with more user-friendly msg#5347
TBonnin merged 1 commit intomasterfrom
tbonnin/jan30/trpcclienterror

Conversation

@TBonnin
Copy link
Collaborator

@TBonnin TBonnin commented Jan 30, 2026


Improve runtime adapter error messaging for job execution

Wraps Lambda and runner runtime invocations in try/catch blocks so low-level TRPCClientError instances are converted into clearer Error messages before propagating through the job pipeline. The startScript operation now throws immediately on missing scripts, missing teams, adapter resolution failures, or adapter invoke errors, ensuring downstream callers receive explicit exceptions rather than opaque Err strings.

Key Changes

• Made LambdaRuntimeAdapter.getFunction private and wrapped invoke in a try/catch that returns Err(new Error('Lambda was unable to execute the function', { cause: err })) when AWS invocation fails
• Added try/catch around RunnerRuntimeAdapter.invoke to convert runner client failures into Err(new Error('Nango runner was unable to execute the function', { cause: err }))
• Updated startScript to throw on missing script/team data, throw adapter errors directly, rethrow failed runtime invocations, and log a consistent Error starting function ... message before returning Err(errMessage)

Affected Areas

• packages/jobs/lib/runtime/lambda.adapter.ts
• packages/jobs/lib/runtime/runner.adapter.ts
• packages/jobs/lib/execution/operations/start.ts


This summary was automatically generated by @propel-code-bot

@TBonnin TBonnin requested a review from a team January 30, 2026 19:22
@my-senior-dev-pr-review
Copy link

🤖 My Senior Dev — Analysis Complete

👤 For @TBonnin

📁 Expert in docs (35 edits) • ⚡ 19th PR this month

View your contributor analytics →


📊 3 files reviewed • 3 need attention

⚠️ Needs Attention:

  • packages/jobs/lib/execution/operations/start.ts — Contains critical error handling logic that could lead to unhandled exceptions if errors are not properly caught upstream.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

});

if (!script) {
const content = `Unable to find integration file for ${nangoProps.syncConfig.sync_name}`;
Copy link
Collaborator Author

@TBonnin TBonnin Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but consolidating all the error handling in the trycatch below which fixes some inconsistencies like always setting the logCtx and span error or returning different shape of errors.

Comment on lines 53 to +55
const runtimeAdapter = await getRuntimeAdapter({ nangoProps, runtimeContext });
if (runtimeAdapter.isErr()) {
return Err(runtimeAdapter.error);
throw runtimeAdapter.error;

This comment was marked as off-topic.

This comment was marked as off-topic.

});
await client.send(command);
return Ok(true);
} catch (err) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also handling the AWS lambda specific error

@TBonnin TBonnin added this pull request to the merge queue Feb 12, 2026
Merged via the queue into master with commit ae2997c Feb 12, 2026
30 of 31 checks passed
@TBonnin TBonnin deleted the tbonnin/jan30/trpcclienterror branch February 12, 2026 19:12
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