3.3 KiB
3.3 KiB
Test Image Upload - Quick Verification
Current Configuration
- R2 Bucket:
sojorn-media - Account ID:
7041ca6e0f40307190dc2e65e2fb5e0f - Custom Domain:
media.sojorn.net - Upload URL:
https://7041ca6e0f40307190dc2e65e2fb5e0f.r2.cloudflarestorage.com/sojorn-media - Public URL:
https://media.sojorn.net
Quick Test
1. Verify Custom Domain is Connected
Go to: https://dash.cloudflare.com → R2 → sojorn-media bucket → Settings
Under "Custom Domains", you should see:
- ✅
media.sojorn.netwith status "Active"
If not connected:
- Click "Connect Domain"
- Enter:
media.sojorn.net - Wait 1-2 minutes for activation
2. Test Upload in App
With the app running:
- Tap compose button
- Select an image
- Add some text
- Post
Watch for:
- Success notification
- Image appears in feed
- No error messages
3. Check What URL Was Generated
After uploading, check the database:
SELECT id, body, image_url, created_at
FROM posts
WHERE image_url IS NOT NULL
ORDER BY created_at DESC
LIMIT 1;
Expected URL format: https://media.sojorn.net/[uuid].[ext]
4. Test URL Directly
Copy the image_url from database and test in browser or curl:
curl -I https://media.sojorn.net/[filename-from-database]
Expected response: HTTP/2 200 OK
Troubleshooting
Edge Function Logs
Check for upload errors:
npx supabase functions logs upload-image --project-ref zwkihedetedlatyvplyz -f
Look for:
- ✅ "Successfully uploaded to R2"
- ❌ "Missing R2_PUBLIC_URL" (means secret not set)
- ❌ "R2 upload failed" (means authentication/permission issue)
Environment Variables
Verify all secrets are set:
npx supabase secrets list --project-ref zwkihedetedlatyvplyz
Required secrets:
- ✅ R2_ACCOUNT_ID
- ✅ R2_ACCESS_KEY
- ✅ R2_SECRET_KEY
- ✅ R2_PUBLIC_URL
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Upload fails with 401 | Invalid R2 credentials | Check R2_ACCESS_KEY and R2_SECRET_KEY |
| Upload succeeds but image 404 | Domain not connected | Connect media.sojorn.net to bucket |
| "Missing R2_PUBLIC_URL" | Secret not set/propagated | Wait 2 minutes, redeploy function |
| Image loads slowly | Not cached | Normal for first load, subsequent loads cached |
Expected Behavior
✅ Upload Flow:
- User selects image → App processes/filters
- App uploads to edge function → Edge function uploads to R2
- Edge function returns:
https://media.sojorn.net/[uuid].jpg - App saves post with image_url to database
- Feed queries posts with image_url
- PostItem widget displays image
✅ Performance:
- First upload: 2-5 seconds (depending on image size)
- Image load: <1 second (Cloudflare CDN)
- Subsequent loads: Instant (cached)
Next Steps After Success
Once working:
- Upload multiple images to test different sizes/formats
- Test filters (grayscale, sepia, etc.)
- Verify images show in all views (feed, profile, chains)
- Check image quality and compression
- Test on different devices/networks
If Still Not Working
Share the following information:
- Edge function logs (last 10 lines)
- App console output (any errors)
- Database query result (image_url value)
- Cloudflare R2 bucket settings screenshot
- Whether domain shows "Active" in R2 settings
Everything is configured - ready to test now! 🚀