feat(chat): migrate POST /api/sandbox/upload to api#1744
feat(chat): migrate POST /api/sandbox/upload to api#1744arpitgupta1214 wants to merge 4 commits into
Conversation
Flips `handleUploadUrl` in lib/sandboxes/uploadSandboxFiles.ts from
the local /api/sandbox/upload route to the new
${getClientApiBaseUrl()}/api/sandboxes/staged-files on api, then
deletes the now-unused local route.
Closes Group 6 of the chat→api migration. Pairs with api PR for
the staged-files handler and docs PR for the OpenAPI entry.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Migrates upload token handshake from chat to api, altering critical path for file uploads. Requires human review to verify API endpoint, CORS, and migration order.
Pairs with the api-side rename of /api/sandboxes/staged-files to /api/sandboxes/stage-files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/sandboxes/uploadSandboxFiles.ts">
<violation number="1" location="lib/sandboxes/uploadSandboxFiles.ts:43">
P1: The upload handshake endpoint path was changed to `/api/sandboxes/stage-files`, but the migrated API route is `/api/sandboxes/staged-files`. This typo will break sandbox file uploads.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const blob = await upload(file.name, file, { | ||
| access: "public", | ||
| handleUploadUrl: "/api/sandbox/upload", | ||
| handleUploadUrl: `${getClientApiBaseUrl()}/api/sandboxes/stage-files`, |
There was a problem hiding this comment.
P1: The upload handshake endpoint path was changed to /api/sandboxes/stage-files, but the migrated API route is /api/sandboxes/staged-files. This typo will break sandbox file uploads.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/sandboxes/uploadSandboxFiles.ts, line 43:
<comment>The upload handshake endpoint path was changed to `/api/sandboxes/stage-files`, but the migrated API route is `/api/sandboxes/staged-files`. This typo will break sandbox file uploads.</comment>
<file context>
@@ -40,7 +40,7 @@ export async function uploadSandboxFiles({
const blob = await upload(file.name, file, {
access: "public",
- handleUploadUrl: `${getClientApiBaseUrl()}/api/sandboxes/staged-files`,
+ handleUploadUrl: `${getClientApiBaseUrl()}/api/sandboxes/stage-files`,
clientPayload: JSON.stringify({ token: accessToken }),
});
</file context>
| handleUploadUrl: `${getClientApiBaseUrl()}/api/sandboxes/stage-files`, | |
| handleUploadUrl: `${getClientApiBaseUrl()}/api/sandboxes/staged-files`, |
Pairs with the api-side rename to the noun-shaped resource path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Vercel Blob client's upload() supports a `headers` option that forwards arbitrary headers onto the handshake POST — replacing the clientPayload.token dance with a normal Bearer header. Pairs with the api-side switch to validateAuthContext(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Cutover for the sandbox upload token handshake.
lib/sandboxes/uploadSandboxFiles.tsnow pointshandleUploadUrlat\${getClientApiBaseUrl()}/api/sandboxes/staged-files(the new api route from api#541) and the local/api/sandbox/uploadroute is deleted. The downstream commit step (POST /api/sandboxes/files) is unchanged.Closes Group 6 of the chat→api migration. Merge order: api → docs → chat.
Test plan
chat.recoupable.comagainstapi.recoupable.comSummary by cubic
Moves the sandbox upload handshake from chat to api and removes the local
/api/sandbox/uploadroute. PointshandleUploadUrlto${getClientApiBaseUrl()}/api/sandboxes/staged-fileand sends auth viaAuthorization: Bearer; the commit step (POST /api/sandboxes/files) is unchanged.POST /api/sandboxes/staged-file.Authorizationheader is accepted.Written for commit 6982d75. Summary will update on new commits.