Improve error logging observability for created_via_invite rollout#1607
Improve error logging observability for created_via_invite rollout#1607riderx merged 2 commits intoriderx/user-joined-metricfrom
Conversation
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
|
* fix(metrics): exclude invited users from User Joined * test(metrics): add created_via_invite coverage * chore(metrics): harden created_via_invite fallback * test: fix created_via_invite fk * Improve error logging observability for created_via_invite rollout (#1607) * Initial plan * feat: log all initial insert errors before retry decision Co-authored-by: riderx <4084527+riderx@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: riderx <4084527+riderx@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Improves observability during the created_via_invite backward-compatible column rollout by ensuring initial insert errors are always logged before any retry/fallback behavior in the invitation acceptance flow.
Changes:
- Added “initial insert error” logging before retry decisions in
ensurePublicUserRowExists. - Added “initial user insert error” logging before retry decisions in the main
accept_invitationhandler. - Removed the error object from the “retrying without column” log line to avoid duplicating the same error in multiple log events.
| // Log any initial error for observability during rollout | ||
| if (insertError) { | ||
| cloudlog({ | ||
| requestId: c.get('requestId'), | ||
| message: 'ensurePublicUserRowExists: initial insert error', | ||
| error: insertError, | ||
| }) | ||
| } |
There was a problem hiding this comment.
These logs are recording insert failures; consider using cloudlogErr (stderr) instead of cloudlog so error-level logs can be filtered/alerted consistently across runtimes.
| // Log any initial error for observability during rollout | ||
| if (userNormalTableError) { | ||
| cloudlog({ | ||
| requestId: c.get('requestId'), | ||
| message: 'accept_invitation: initial user insert error', | ||
| error: userNormalTableError, | ||
| }) | ||
| } |
There was a problem hiding this comment.
This is logging an actual insert error; consider emitting it via cloudlogErr (stderr) instead of cloudlog to keep error logs consistent and easier to detect in production logging pipelines.



Summary
Addresses feedback on #1602: log all initial insert errors before retry decisions to improve observability during
created_via_invitecolumn rollout.Pattern change:
This ensures visibility into unexpected errors that might be masked by successful retries, even when the missing column error is not the root cause.
Modified locations:
ensurePublicUserRowExists: lines 150-156accept_invitationhandler: lines 456-462Test plan
Screenshots
N/A - backend logging change only
Checklist
bun run lint:backend && bun run lint.accordingly.
my tests
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.