name: doccorretor-vps-storage-scan
description: "DocCorretor: how to scan VPS local storage files — Edge Functions CANNOT access /var/www/documentos/uploads/"
DocCorretor: VPS Storage File Scan — Architecture Limitation
Context
DocCorretor (documentos.rochasalesseguros.com.br) stores files on the local VPS filesystem at /var/www/documentos/uploads/, NOT in Supabase Storage. The app runs on VPS at /var/www/documentos2/app.
Critical Limitation: Edge Functions Cannot Scan VPS Filesystem
Supabase Edge Functions run on Supabase's own infrastructure (Deno Deploy), NOT on the local VPS. This means:
- -
Deno.stat("/var/www/documentos/uploads/...")will always fail with "file not found" - - Edge Functions have no access to the local VPS filesystem
- - Any scan action in an Edge Function that checks local paths will report all files as missing
- - ✅
clientstable row count - - ✅
client_folderstable row count - - ✅
documentstable row count - - ✅
storage_pathfield values indocumentstable - - ✅ Foreign key relationships (client_id exists in clients table)
- - ❌ Actual file existence on VPS disk — requires VPS SSH access
- - IP: 31.97.243.106
- - User: root
- - Auth: password (sshpass) or SSH key
- - Upload path:
/var/www/documentos/uploads/ - - App path:
/var/www/documentos2/app/
How to Do a Real Filesystem Scan
To verify that files physically exist on the VPS disk, you MUST run commands directly on the VPS via SSH:
`bash
Count all files in uploads directory
sshpass -p '
"find /var/www/documentos/uploads/ -type f | wc -l"
List a sample
sshpass -p '
"ls /var/www/documentos/uploads/
`
Alternative: Expose a Local API Endpoint
If you can't SSH directly, add a local endpoint to the DocCorretor app that runs on the VPS:
`typescript
// In doccorretor app — e.g. /api/scan-storage
// This endpoint runs ON the VPS and can access /var/www/documentos/uploads/
`
Then call it from the Edge Function or external tool.
What CAN Be Verified via Edge Function (Supabase side only)
Summary
| Check | Method |
| ------- | -------- |
| DB record counts | Edge Function (Supabase) |
| storage_path fields populated | Edge Function (Supabase) |
| client_id FK validity | Edge Function (Supabase) |
| Files physically on VPS disk | Requires SSH to VPS directly |
| App UI showing correct data | Browser login test |