refactor: enhance error handling and streamline API key management in LLM modules
From the PR description
Summary
Hardens workflow listing against shared-workflow crash cases and improves missing API key errors across LLM providers.
Changes
- Wrap workflow route async handlers so rejected promises are passed to Express error handling.
- Add workflow route error middleware to return a controlled 500 instead of allowing unhandled route failures.
- Make shared-workflow sharer-name enrichment non-fatal.
- Replace
auth.admin.listUsers({ perPage: 1000 })with targetedgetUserByIdlookups for only the relevant sharer IDs. - Keep workflow listing functional even if sharer profile/email lookup fails.
- Add clear missing API key errors for Gemini, OpenAI, and Anthropic before provider calls are attempted.
Why
A shared workflow could cause GET /workflows to throw during sharer enrichment. In Express 4, unhandled async route rejections can escape normal middleware and risk taking down the backend process.
This PR makes the workflow route fail closed and avoids the expensive all-users auth lookup.
Testing
npm run build --prefix backend
Our analysis
Harden workflow route against sharer enrichment crashes — read the full analysis →
Think the analysis missed something the PR description covers?
Commits in this PR (2)
| SHA | Subject | Author | Date | |
|---|---|---|---|---|
a2368a74 | refactor: enhance error handling and streamline API key management in LLM modules | willchen96 | 2026-05-14 | ↗ GitHub |
08d99678 | feat: enhance workflow sharing by preventing users from sharing with themselves and normalizing email inputs | willchen96 | 2026-05-14 | ↗ GitHub |
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-132.md from
inside the repo you want the changes in.