Skip to content

Latest commit

 

History

History
104 lines (76 loc) · 2.84 KB

File metadata and controls

104 lines (76 loc) · 2.84 KB

🚨 CRITICAL PRODUCTION FIX - Bounty Payment 500 Error

Problem on Production RIGHT NOW

What's broken:

  • Users can create bounties successfully ✅
  • When they try to PAY for the bounty, they get "Failed to process payment" ❌
  • Server returns 500 Internal Server Error
  • This has been reported multiple times

Root cause: The database is missing the blockchain_bounty_id column that the code expects.

The Fix (Already in GitHub)

Branch: phase-2-security-implementation

What it includes:

  1. Database migration that adds the missing column
  2. Updated TypeScript types
  3. Better error handling and user experience

Deployment Instructions (3 Steps)

Step 1: Pull Latest Code

cd /path/to/Roxonn-Platform
git fetch origin
git checkout phase-2-security-implementation
git pull origin phase-2-security-implementation

Step 2: Run This SQL on Production Database

-- Add the missing column
ALTER TABLE community_bounties
  ADD COLUMN IF NOT EXISTS blockchain_bounty_id INTEGER;

-- Add documentation
COMMENT ON COLUMN community_bounties.blockchain_bounty_id IS
  'On-chain bounty ID from CommunityBountyEscrow.sol, used by relayer to complete payouts';

-- Add index for performance
CREATE INDEX IF NOT EXISTS idx_community_bounties_blockchain_id
  ON community_bounties(blockchain_bounty_id)
  WHERE blockchain_bounty_id IS NOT NULL;

Or run the migration file directly:

psql -U your_user -d your_database -f migrations/0024_add_blockchain_bounty_id.sql

Step 3: Restart Production Server

# However you normally restart (examples):
pm2 restart all
# OR
systemctl restart roxonn-server
# OR
docker-compose restart

How to Verify Fix Worked

  1. Go to https://app.roxonn.com/community-bounties
  2. Login with GitHub
  3. Create a test bounty
  4. Click "Pay" button
  5. Should work without 500 error

What Files Were Changed

migrations/0024_add_blockchain_bounty_id.sql  ← THE CRITICAL FIX
shared/schema.ts                              ← TypeScript schema
client/src/pages/community-bounties-page.tsx  ← Better UX
client/src/lib/community-bounties-api.ts      ← TypeScript types

Evidence This is The Problem

Error from production:

POST https://app.roxonn.com/api/community-bounties/31/pay
Status: 500 Internal Server Error

Bounty ID 31 was created successfully, but payment failed because the database doesn't have the column the code needs.

Why This Happened

Someone added blockchainBountyId to the TypeScript code but never ran the database migration on production. Local/dev worked fine because migrations were run there, but production database was left behind.


Time to fix: ~5 minutes Impact if not fixed: Bounty payments remain broken Risk of fix: Very low - just adds a nullable column

Any questions? The code is ready, tested, and pushed to GitHub.