Modern browsers require HTTPS for camera access. Your Next.js app is running on HTTP (localhost:3000), which prevents camera access.
We've created a custom HTTPS server for development.
-
Stop your current development server (if running):
# Press Ctrl+C in your terminal -
Start the HTTPS development server:
npm run dev:https
-
Access your app:
- Open:
https://localhost:3000 - Accept the SSL certificate warning (it's self-signed for development)
- Camera access should now work!
- Open:
When you first visit https://localhost:3000, your browser will show a security warning because we're using a self-signed certificate. This is normal for development.
To proceed:
- Chrome/Edge: Click "Advanced" → "Proceed to localhost (unsafe)"
- Firefox: Click "Advanced" → "Accept the Risk and Continue"
- Safari: Click "Show Details" → "visit this website" → "Visit Website"
- Make sure you're on
https://localhost:3000(nothttp://) - Check browser console for error messages
- Ensure camera permissions are allowed in browser settings
- Try refreshing the page after accepting the SSL certificate
If you get certificate errors, regenerate them:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodesThe HTTPS server uses port 3000. If it's already in use:
- Stop other development servers
- Or modify the port in
server.js
- Use
npm run dev:httpsfor development with camera access - Use
npm run devfor regular HTTP development (no camera) - Use
npm run buildandnpm run startfor production
server.js- Custom HTTPS server for Next.jsCAMERA_SETUP.md- This guide- Updated
package.jsonwithdev:httpsscript