Skip to content

πŸ› Debug: Live Products Not Displaying on Main PageΒ #16

@SamoTech

Description

@SamoTech

βœ… RESOLVED - Awaiting Verification

Status: Configuration fixed, enhanced error logging deployed
Last Updated: 2026-02-17 20:24 UTC


Resolution Summary

What Was Fixed

  1. βœ… Environment Variables Corrected

    • Removed deprecated EBAY_APP_ID from production
    • Confirmed OAuth credentials in place (EBAY_CLIENT_ID, EBAY_CLIENT_SECRET)
    • Health endpoint shows: "hasAppId": false βœ…
  2. βœ… Enhanced Error Logging (Commits: 6655b91, 2ef662b)

    • Added detailed OAuth and API error logging
    • Removed silent fallback to static products
    • API now returns error details instead of hiding issues
  3. βœ… Frontend Error Handling (Commit: 2ef662b)

    • Shows diagnostic error banner when API fails
    • Links to /api/health for debugging
    • Links to troubleshooting guide (this issue)
    • Increased timeout to 20 seconds
  4. βœ… Updated Documentation

    • README.md updated with OAuth setup instructions
    • .env.example updated with correct variables
    • Health check endpoint documented

Current Situation

Health Check Status: βœ… HEALTHY

{
  "status": "healthy",
  "ebay": {
    "integration": {
      "mode": "client_credentials",
      "apiType": "Browse"
    },
    "configuration": {
      "hasClientId": true,
      "hasClientSecret": true,
      "hasAppId": false  // βœ… Fixed
    }
  }
}

Observed Behavior:

  • βœ… Green "Live eBay catalog active" badge appears
  • ❌ Products are still static (not from eBay)
  • πŸ” Indicates OAuth succeeds but API returns 0 products

Next Debugging Steps

Step 1: Check Vercel Function Logs (CRITICAL)

After redeployment, check the live logs:

  1. Go to: Vercel Dashboard β†’ ebay-store β†’ Deployments
  2. Click latest deployment β†’ "Functions" tab
  3. Refresh homepage to trigger API call
  4. Look for logs from /api/products/discover

What to look for:

βœ… Success Pattern:

πŸ” eBay Integration Status: {mode: 'client_credentials'}
πŸ” Fetching fresh products from eBay Browse API...
πŸ“… Day 2 - Searching for: "smart home devices"
βœ… eBay OAuth token acquired (expires in 7200s)
πŸ“¦ searchEbayProducts returned 20 products
βœ… Successfully fetched 20 live products from eBay

❌ Error Patterns:

Pattern A: OAuth Failure

❌ Failed to get eBay OAuth token: 401

β†’ Fix: Credentials are invalid or incorrect. Verify in eBay Developer Portal.

Pattern B: API Rate Limit

❌ eBay Browse API error (429): Rate limit exceeded

β†’ Fix: Wait 1 hour or upgrade eBay API tier.

Pattern C: Empty Response

βœ… eBay OAuth token acquired
πŸ“¦ searchEbayProducts returned 0 products

β†’ Fix: Keyword may not match products, or API restrictions.

Step 2: Test API Endpoint Directly

Visit: https://ebay-store.vercel.app/api/products/discover

Expected Response (success):

{
  "products": [...],
  "source": "ebay_live",
  "total": 20,
  "keyword": "smart home devices"
}

Error Response (with details):

{
  "error": "eBay API returned no products",
  "source": "error",
  "details": {
    "keyword": "...",
    "message": "OAuth may have failed or API rate limit reached"
  }
}

Step 3: Verify eBay Credentials

  1. Login to eBay Developer Portal: https://developer.ebay.com/my/keys
  2. Check your Production keyset:
    • Status should be "Active"
    • "OAuth Redirect URIs" should be configured (if using Authorization Code flow)
    • For Client Credentials flow (current setup), redirect URI not needed
  3. Verify credentials match Vercel:
    • Copy Client ID β†’ Compare with Vercel env var
    • Copy Client Secret β†’ Compare with Vercel env var
  4. Check API access:
    • Browse API should be enabled
    • Check if sandbox vs production mode

Step 4: Test OAuth Manually (Advanced)

Test OAuth token generation manually:

# Replace with your actual credentials
curl -X POST 'https://api.ebay.com/identity/v1/oauth2/token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Authorization: Basic BASE64(CLIENT_ID:CLIENT_SECRET)' \
  -d 'grant_type=client_credentials&scope=https://api.ebay.com/oauth/api_scope'

Should return:

{
  "access_token": "v^1.1#...",
  "expires_in": 7200,
  "token_type": "Application Access Token"
}

Possible Root Causes

1. Sandbox vs Production Credentials

❌ Using Sandbox credentials in Production

  • Sandbox credentials only work with sandbox.ebay.com
  • Production needs production credentials

βœ… Fix: Ensure using Production keyset from eBay Developer Portal

2. API Restrictions

❌ eBay account not approved for Browse API

  • Some accounts require approval for production access
  • Browse API may be rate-limited for new accounts

βœ… Fix: Check eBay Developer account status and API limits

3. OAuth Scope Issues

❌ Wrong OAuth scope requested

  • Default: https://api.ebay.com/oauth/api_scope
  • May need specific Browse API scope

βœ… Fix: Check eBay documentation for required Browse API scopes

4. Marketplace ID Issues

❌ Wrong marketplace configured

  • Currently set to: EBAY_US
  • Your account may be restricted to different marketplace

βœ… Fix: Try EBAY_GB, EBAY_DE, etc. based on your account region


Action Items

For User

  • Check Vercel Function Logs after next page load
  • Share log output here or via email
  • Verify eBay credentials are "Production" not "Sandbox"
  • Confirm eBay Developer account has Browse API access
  • Test direct API endpoint: /api/products/discover

For Development Team

  • Add comprehensive error logging
  • Remove static product fallback
  • Add frontend error display
  • Create health check endpoint
  • Update documentation
  • Add OAuth token validation test
  • Add Browse API response schema validation
  • Consider adding retry logic with exponential backoff

Expected Timeline

  • Now: Redeployment complete, enhanced logging active
  • 5 minutes: User checks Vercel logs and reports findings
  • 15 minutes: Root cause identified from logs
  • 30 minutes: Fix applied and verified
  • Resolution: Live products loading successfully

How to Report Progress

Please share:

  1. Vercel Function Logs screenshot or text
  2. Direct API response from /api/products/discover
  3. eBay Developer Portal credential status (Production vs Sandbox)
  4. Any error messages from browser console

Success Criteria (Not Yet Met)

  • /api/products/discover returns source: 'ebay_live'
  • Function logs show "βœ… Successfully fetched 20 live products"
  • Homepage displays different products each day
  • No error banner on homepage
  • Products have real eBay images and prices

Reference Links


Status: Awaiting Vercel Function Logs to identify specific API failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions