Skip to content

fix(production): keep the camera stream alive on Vercel - #15

Merged
tech5-opti merged 1 commit into
mainfrom
tushar
Aug 21, 2026
Merged

fix(production): keep the camera stream alive on Vercel#15
tech5-opti merged 1 commit into
mainfrom
tushar

Conversation

@tech5-opti

Copy link
Copy Markdown
Collaborator

The prod frontend runs on Vercel, so the camera proxy is a serverless function with a wall-clock budget — and an MJPEG feed is a response that deliberately never ends. On the platform default (as little as 10s on some plans) the picture is cut off seconds after it appears, which reads as a broken camera rather than a platform limit.

This is also why it works locally and not in production: next dev has no such budget.

Changes

  • maxDuration = 300 on the route — the documented ceiling
  • Bounded auto-reconnect in the panel (20 consecutive attempts)

300s is a ceiling, not a fix: the stream is still killed roughly every five minutes. Reconnecting silently is the honest response to a limit we know about — making the operator re-toggle every five minutes would be pretending it is their problem. The bound stops a stream that fails instantly from spinning, and surfaces a genuine fault instead of retrying forever.

Note on architecture

Proxying a continuous video feed through serverless functions is billed by duration and bandwidth (~0.6 MB/s at 2 fps). If the camera becomes something people leave open, the stream should bypass Vercel and go browser → Tensor-Core directly with a short-lived signed URL.

🤖 Generated with Claude Code

The prod frontend runs on Vercel, so this proxy is a serverless function
with a wall-clock budget - and an MJPEG feed is a response that
deliberately never ends. On the platform default (as little as 10s on
some plans) the picture is cut off seconds after it appears, which reads
as a broken camera rather than a platform limit. maxDuration raises that
to the documented 300s ceiling.

300s is a ceiling, not a fix: the stream is still killed when it expires,
about every five minutes. So the panel reconnects on its own, bounded at
20 consecutive attempts. Silently reconnecting is the honest response to
a limit we know about - making the operator re-toggle every five minutes
would be pretending it is their problem - while the bound stops a stream
that fails instantly from spinning, and surfaces a genuine fault instead
of retrying forever.

Local development is unaffected: `next dev` has no such budget, which is
why the camera works there and expires in production.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@tech5-opti
tech5-opti merged commit 01e794d into main Aug 21, 2026
1 of 4 checks passed

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 06633e37-22f4-4ddd-8d77-d3bfa09d85ee


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

Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
tensor Building Building Preview Aug 21, 2026 9:01am
tensor-9bct Building Building Preview Aug 21, 2026 9:01am

Request Review

@sonarqubecloud

Copy link
Copy Markdown

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