CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

fix(vapron): rebuild platform client against published tRPC API #4077

Merged⚡ AI-generatedXSccantynz wants to mergeclaude/google-oauth-setup-UYn0Rmainopened Jun 10, 2026
ccantynzcommented Jun 10, 2026

Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/AlecRae.com/pull/54


What

Resolves Known Issue #19 — the Vapron platform client was built to a guessed spec and was wrong on transport. This rebuilds it against the real API from the Vapron integration guide.

The problem

The old client talked to https://api.vapron.ai/api/platform/<thing> with raw JSON bodies. The real platform is a tRPC API with a superjson envelope. Every call would have failed against the live service.

Changes

apps/api/src/lib/vapron.ts — rebuilt transport + surface:

  • Base URL is the tRPC root: https://api.vapron.ai/api/trpc
  • Request bodies use the superjson { "json": { ...params } } envelope; GET queries pass ?input=<urlenc {"json":...}>
  • Responses unwrap from result.data.json (tolerant of plainer shapes)
  • Errors parsed from the tRPC { error: { json: { message, data: { code, httpStatus } } } } envelope
  • Real procedure names: customerEmail.send, aiGateway.complete, objectStorage.listBuckets / objectStorage.createBucket, aiDeploy.quickDeploy
  • Removed the fictional secrets.get — there is no such procedure; Vapron secrets are runtime env vars, not API-fetched
  • ai.complete() returns normalized { text, raw }; text extraction tolerates Anthropic / OpenAI / plain text|content|completion shapes pending live-call confirmation
  • Default AI model claude-sonnet-4-6 per the guide

apps/api/src/lib/ai.ts — fallback path now calls vapron.ai.complete() and reads .text.

Tests — rewritten for the tRPC envelope (vapron.test.ts), updated fixtures (ai.test.ts, transactional-email.test.ts). All 115 API tests pass.

ConfigVAPRON_BASE_URL in .env.production now points at /api/trpc.

Note on response shapes

The AI-gateway response shape isn't documented, so extraction is deliberately tolerant. The first live call should confirm the actual shape so we can tighten the Zod schema (carried forward in issue #19's note).

Verification

  • bun run test — 115/115 ✅
  • bun run typecheck — ✅
  • bun run lint — 0 errors (pre-existing console warnings only, none in changed files)
  • bun run docs:check — ✅

https://claude.ai/code/session_01McgJLnTbZG9mwhfwd5iAX3


Generated by Claude Code

ccantynzcommented Jun 10, 2026

Originally written by @vercel[bot] on GitHub.


Deployment failed with the following error:

There is no GitHub account connected to this Vercel account.
ccantynzcommented Jun 10, 2026

Originally written by @vercel[bot] on GitHub.


The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
alec-rae-com-admin Ready Ready Preview, Comment Jun 10, 2026 9:17am

Cross-repo impact

See what breaks downstream if this PR merges.

Analyze →
⮌ Merged

This pull request was merged into main.

c comment · e edit title · m merge · a approve · r request changes · ? shortcuts