Payment requests were looping infinitely in Base MiniApp environment instead of completing successfully.
File: App.tsx line 155
Before:
}, [isConnected, address, pendingPayment]);After:
}, [isConnected, address, pendingPayment, loading]);Why: Without loading in dependencies, the useEffect could retrigger during payment processing.
Issue: Base MiniApp already has wallet connected, but app was trying to auto-connect again.
Fix: Added MiniApp detection:
const isInMiniApp = typeof window !== 'undefined' && window.parent !== window;
useEffect(() => {
if (isInMiniApp) {
console.log('Running in Base MiniApp - skipping auto-connect');
return;
}
// ... auto-connect logic
}, [isConnected, connectors, connect, isInMiniApp]);Fix: Added comprehensive logging:
- π Payment start
- β Payment success
- β Payment failure
- π Flag reset
Open browser DevTools and look for:
Running in Base MiniApp - skipping auto-connect
π Starting payment process { pendingPayment: true, address: '0x...', ... }
β
Payment completed successfully
π Resetting payment processing flag
- Send message requiring payment
- Payment request should appear
- Click "Sign & Pay" (or auto-trigger)
- Should only see ONE payment attempt
- Container should be leased successfully
If you see multiple "π Starting payment process" logs without "β Payment completed", there's still an issue.
# Commit changes
git add frontend/src/App.tsx
git commit -m "fix: resolve infinite payment loop in Base MiniApp
- Add loading to useEffect dependencies
- Detect Base MiniApp environment and skip auto-wallet-connect
- Add comprehensive logging for debugging payment flow"
# Deploy
git push
vercel --prodIf the issue persists, check:
- Network Tab: Look for duplicate
/chatrequests - Console Errors: Any errors during payment signing
- Wallet Popup: Does it appear multiple times?
- Backend Logs: Check for duplicate payment processing
- Auto-connects wallet on page load
- Auto-triggers payment when wallet connects
- Skips auto-wallet-connect (wallet already connected)
- Auto-triggers payment when payment required
- Uses Base App's built-in wallet
frontend/src/App.tsx- Main payment logicfrontend/src/Providers.tsx- Wallet configurationfrontend/public/.well-known/farcaster.json- MiniApp metadata