Skip to content

Fix Discord notifications not firing for new signups#935

Merged
onchainlu merged 2 commits into
mainfrom
fix-discord-notifications
May 29, 2026
Merged

Fix Discord notifications not firing for new signups#935
onchainlu merged 2 commits into
mainfrom
fix-discord-notifications

Conversation

@onchainlu
Copy link
Copy Markdown
Contributor

@onchainlu onchainlu commented May 29, 2026

Summary

  • getOriginResourceCount now excludes deprecated resources — previously counted all resources including deprecated ones, so re-registrations of origins with only deprecated resources were silently treated as existing and skipped the notification.
  • Facilitator sync job now fires notifications for new origins — the cron job was pre-seeding origin records without notifications, which meant origins first discovered via facilitator sync would already exist when the merchant later registered manually, preventing the notification from ever firing. Sync-discovered origins only go to the notifications webhook, not merchant research.
  • notifyNewServer now accepts a merchantResearch option — defaults to true (existing behavior unchanged), but the sync job passes false since facilitator-discovered origins aren't real signups.

Test plan

  • Verify DISCORD_NOTIFICATIONS_WEBHOOK_URL is set in Vercel for x402scan
  • Register a new origin — Discord notification should fire to both webhooks
  • Re-register an origin with only deprecated resources — notification should fire again
  • Verify facilitator sync discovers a new origin — notification fires only to the notifications webhook, not merchant research

Two bugs prevented notifications:

1. getOriginResourceCount counted deprecated resources, so re-registrations
   of origins with only deprecated resources were treated as existing (count > 0)
   and silently skipped the notification. Now filters to deprecatedAt: null.

2. The facilitator sync cron job created origin records without notifications.
   Origins first discovered by the sync job would already exist when the
   merchant later registered manually, preventing the notification. Now
   snapshots origin counts before upserting and fires notifyNewServer for
   any origin that goes from 0 to >0 active resources.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
x402scan Ready Ready Preview, Comment May 29, 2026 12:39am

Request Review

Facilitator-discovered origins are automated, not real signups — they
shouldn't trigger merchant research follow-up. Added merchantResearch
option to notifyNewServer (defaults true), sync job passes false.
@onchainlu onchainlu merged commit 7072f48 into main May 29, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant