March 4 Production Fixes

10 issues resolved — auth, payments, images, login, and infrastructure. All deployed to production.

Summary

#IssueCategoryStatus
1"Failed to load restaurants" on first loadAuthFixed
2Slow image loading + no loading indicatorsUXFixed
3Phone login (Twilio) setup + profile flowAuthFixed
4Phone users' names disappearing after refreshAuthFixed
5Image storage migration to client's CloudflareInfraFixed
6Sign out button stuck on loading screenAuthFixed
7Google sign-in redirecting to localhostAuthFixed
8Product image upload failing (Bug 6)InfraFixed
9Cash order with discount code error (Item 14)PaymentsFixed
10CyberSource 3DS full rework (11 sub-issues)PaymentsFixed

Auth Race Condition

Data fetching hooks fired SWR requests before the Supabase auth session was ready, causing empty/failed loads on first visit.

1
Page mounts — SWR hooks fire immediately
2
Auth session not ready — API calls fail (no token)
3
Fix: Gate SWR keys behind useAuth().loading — null key = no request

Affected hooks: useRestaurants, useRestaurant, useMenuItems

Google OAuth Localhost Redirect

Auth callback route used new URL(request.url).origin as fallback for redirect base URL. Production runs Next.js on localhost:3000 behind a reverse proxy that doesn't forward the Host header — so the origin resolved to http://localhost:3000.

Fix: Hardcoded https://ricoya.ipnoelp.com as fallback in auth callback.

CyberSource 3DS Rework

Full rework based on BAC reviewer feedback. 11 issues fixed including missing credentials, amount mismatches, frictionless flow, and capture enablement.

1
SetupPOST /api/payments/setup gets referenceId + device collection URL
2
Fingerprint — Hidden iframe collects browser device data
3
Payment — Card + referenceId + deviceInformation sent to CyberSource
4
3DS — Challenge (bank redirect) or frictionless (inline verify)
5
Capture — Payment captured (was previously auth-only)
BrandECICAVVStatus
Visa05PresentCaptured
Mastercardspaucaf: 2Captured
AMEXSandbox limitation

Image Infrastructure

Migrated 360 images (247MB) to client's Cloudflare R2 bucket. Set up images.ricoya.net as custom domain for CDN edge caching. Moved ricoya.net DNS to Cloudflare.

📱
App
Next.js Image
CDN Edge
images.ricoya.net
🗄️
R2 Bucket
ricoya-images

Added shimmer loading indicators + fade-in transitions for menu items, modals, and restaurant cards.

📄 Auth Race Condition Fix · Google OAuth Fix · Phone OTP · CyberSource 3DS · Cloudflare CDN
← Back to Ricoya