Update: I think I've got the Next.js app

Update: I think I've got the Next.js app in a satisfying state: - Moved most server components and server action "magic" to good old client components with api routes HTTP calls from the user's browser. - The data flow just makes more sense mentally, and it gives you a chance to test backend logic from outside the nextjs app (with postman for example). - With Tanstack Query client side you can also retry queries if they go wrong or while waiting for a database update for example. - Moved the critical and hard to debug Stripe payment logic to standalone (different project) workers. I now have 2 stripe webhooks workers waiting for POST calls from stripe, one in stripe test mode, one in stripe live mode. Having a deployed test mode worker that is bound to a deployed D1 database was key for my debugging. D1 was rejecting writes because of a foreign key constraint (I was passing the wrong id). - Enabled logpush for the standalone workers (don't forget to add logpush = true in wrangler.toml after enabling logpush in the dashboard). Now my logs are persisted and I can go check what went wrong in prod for these critical workers. - Next step, looking for a simple way to access / read / sort / filter the log.gz files that are on R2. Is there an app that makes it simple? Or are most people using command-line jq as specified here? https://developers.cloudflare.com/logs/tutorials/parsing-json-log-data/ At the end of the day the mistake was mine, and I would like to apologize for my earler negative comments, but some extra and persistent logging (on D1 operations, on cloudflare pages, on cloudflare pages workers) would really help people like me coming from vercel and switiching to the cloudflare ecosystem.
2 Replies
loco
loco6mo ago
do you use the stripe webhooks on seperate domain or the main domain of the project? I was thinking of doing similar as i am also facing issues with debugging
laurent
laurent6mo ago
completely different project and domain (just made a new cloudflare worker)
Want results from more Discord servers?
Add your server