Skip to content

Sync v2 SDK with preview bootstrap API#163

Open
rickeyswuave wants to merge 2 commits into
v2from
rickey/preview-bootstrap-sdk
Open

Sync v2 SDK with preview bootstrap API#163
rickeyswuave wants to merge 2 commits into
v2from
rickey/preview-bootstrap-sdk

Conversation

@rickeyswuave

Copy link
Copy Markdown
Collaborator

Summary

Sync the v2 SDK with the secure preview bootstrap API from vercel/v0#26583.

  • Replaces the SDK OpenAPI snapshot with the exact file generated by the v0 PR.
  • Regenerates the TypeScript SDK and AI SDK tools.
  • Removes the obsolete fetchPreview proxy helper and exports.

Problem

The previous SDK modeled previews as a raw URL, token, and expiration. Its fetchPreview helper forwarded requests with x-v0-preview-token, but browser redirects and Next.js asset requests do not preserve that custom header without a full reverse proxy.

The v0 API now returns a nullable { url } containing a short-lived bootstrap URL, so the header-based SDK helper is no longer valid.

Solution

v0.chats.getPreview is regenerated with the new direct response:

const { data: preview } = await v0.chats.getPreview({ chatId })

Customers can redirect their authenticated iframe route to preview.url. The v0 preview gateway establishes the browser session, then the preview and its assets load directly from the preview origin.

The obsolete proxy helper, preview token header, refresh header, and related exports are removed.

Verification

  • bun run generate
  • bun run typecheck
  • bun run build
  • AI-tools tests: 6 passed
  • Confirmed the SDK OpenAPI file matches vercel/v0#26583 exactly.
  • Confirmed no fetchPreview, preview-token, or preview-refresh references remain.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
v0-sdk-clone-demo Error Error Open in v0 Jul 10, 2026 5:13am
v0-sdk-playground Error Error Open in v0 Jul 10, 2026 5:13am
v0-sdk-simple-demo Error Error Open in v0 Jul 10, 2026 5:13am

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Example reads preview.preview after the getPreview SDK response shape flattened to { url: string } | null, so it always returns null and breaks next build type checking.

Fix on Vercel

@rickeyswuave
rickeyswuave marked this pull request as ready for review July 10, 2026 16:34
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.

1 participant