Skip to content

fix: shared audit route, Stripe 400, readable errors, hero screenshot on mobile - #5

Merged
riteshbonthalakoti merged 4 commits into
mainfrom
claude/fix-api-edge-cases
Nov 3, 2026
Merged

riteshbonthalakoti merged 4 commits into
mainfrom
claude/fix-api-edge-cases

Conversation

@riteshbonthalakoti

@riteshbonthalakoti riteshbonthalakoti commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

What

Four small fixes found while testing production as a mobile user:

  • /api/audit/[id] imported a legacy db module that queries a dimension_results table that does not exist, so every request returned 500 and cached report links (/analyze?id=) never loaded. It now uses getAuditById and returns the shape the analyze page expects (without user_id); unknown ids return 404.
  • POST /api/stripe with an empty/invalid body returned 500; it now returns 400.
  • Raw provider text such as 400 <model> is not a valid model ID was shown to users. It is logged server-side and mapped to a capture-failed, busy, or generic message.
  • The first capture in the filmstrip used a slow thum.io URL that the browser often failed to load (broken image on mobile). The hero is now uploaded to Blob and served from there when the Blob token is set.

Type

  • Bug fix

Checklist

/api/audit/[id] imported a legacy db module that queries a dimension_results
table which does not exist, so every request returned 500 and cached report
links never loaded. Use getAuditById and return the shape the analyze page
expects, without exposing user_id.
Raw text like '400 <model> is not a valid model ID' reached users. Log the
real error server-side and map it to a capture-failed, busy, or generic message.
The first capture used a thum.io URL (15s viewport wait) that the browser
often failed to load, leaving a broken image in the filmstrip.
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
roastlab Error Error Nov 3, 2026 9:03am UTC

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2f71c68d-cf10-45b4-b7ae-1db3bbec1450
Commits

Reviewing files that changed from the base of the PR and between c18aba3 and 101c2df.

Files selected for processing: 4
  • app/api/analyze/route.ts
  • app/api/audit/[id]/route.ts
  • app/api/stripe/route.ts
  • lib/screenshot.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

Copy link
Copy Markdown
Owner Author

The Vercel preview check is red with Failed to collect page data for /api/stripe (Neither apiKey nor config.authenticator provided). That is the Stripe client being constructed at module scope in app/api/stripe/route.ts with no STRIPE_SECRET_KEY in the preview environment, the same failure seen on #1-#4. This PR's edit to that file only wraps req.json() in a try/catch; it does not touch the client construction. Known and left as is (see #1).


Generated by Claude Code

@riteshbonthalakoti
riteshbonthalakoti marked this pull request as ready for review November 3, 2026 09:28
@riteshbonthalakoti
riteshbonthalakoti merged commit 0bbfdba into main Nov 3, 2026
5 of 6 checks passed

This branch had an error being deployed

1 failed deployment
Preview — 101c2df4 Deployed Nov 3, 2026 by vercel[bot]
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.

2 participants