-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Context
I recently deployed CloudMeet to Cloudflare Pages following the README instructions. While I eventually got it working, the experience was challenging. This issue aims to provide constructive feedback and spark discussion on how to improve the deployment UX for self-hosters.
Summary of Issues Encountered
During deployment, I encountered several bugs that are now tracked separately:
- #8 - Build fails due to duplicate variable declaration
- #9 - Event type creation fails silently
- #10 - Calendar availability only checks primary calendar
- #11 - SSR causes 500 errors on direct URL access
The Biggest Challenge: Lack of Observability
The most frustrating aspect of deployment was not knowing what went wrong when things failed.
What I Experienced
-
Generic 500 errors everywhere - When something fails, you get
{"message":"Internal Error"}with zero context about what actually happened. -
No access to logs - There's no easy way to see server-side logs.
wrangler pages deployment tailexists but:- Requires knowing the specific deployment ID
- Often doesn't capture the errors you need
- Doesn't work well in non-interactive contexts
-
Silent authentication failures - When I set secrets with trailing newlines (using
echoinstead ofprintf), the OAuth flow entered an infinite redirect loop. No error was logged anywhere - I had to guess that the secrets were malformed. -
SSR vs Client-side mystery - The booking page worked when navigating from the homepage but returned 500 when accessed directly. Same URL, same code, completely different behavior - and no indication why.
-
Database issues invisible - When I accidentally created two users (logged in with wrong account first), the public pages silently showed the wrong user. No warning, no error - just confusing behavior.
Impact
Each issue required significant debugging time:
- Reading source code to understand what could fail
- Making educated guesses about root causes
- Trial and error to find solutions
Suggestions for Improvement
1. Better Error Messages
Instead of:
{"message":"Internal Error"}Consider:
{
"message": "Failed to create event type",
"code": "DB_INSERT_FAILED",
"details": "Cannot call toString on null value",
"file": "event-types/new/+page.server.ts",
"line": 119
}Even if detailed errors are only shown in development mode, it would help immensely.
2. Health Check Endpoint
A /api/health endpoint that verifies:
- Database connection works
- KV namespace is accessible
- Required environment variables are set
- OAuth configuration is valid
This would catch 90% of deployment issues immediately.
3. Deployment Verification Script
A npm run verify-deployment command that:
- Checks all required secrets are set
- Validates secret formats (no newlines, correct patterns)
- Tests database connectivity
- Verifies OAuth redirect URIs match APP_URL
4. Better Documentation for Edge Cases
The README covers the happy path well, but doesn't address:
- What to do when you get a 500 error
- How to debug authentication issues
- The single-user assumption and its implications
- Required wrangler.toml settings like
nodejs_compat
5. Request Tracing
Add a request ID to all responses:
X-Request-Id: abc123
And log it server-side so errors can be correlated.
What Worked Well
To be fair, some things were smooth:
- The GitHub Actions workflow is well-structured
- D1 and KV setup via wrangler is straightforward
- The application itself is well-designed once running
Questions for Discussion
- Is there appetite for improving observability, or is this considered out of scope for a "simple" Calendly alternative?
- Would a
--verbosedeployment mode that logs more details be feasible? - Should the app detect common misconfigurations and warn users?
Happy to contribute PRs if there's alignment on the direction.