Skip to content

fix:deployment fix#245

Merged
OlufunbiIK merged 1 commit intomainfrom
cleaning-the-repo
Mar 23, 2026
Merged

fix:deployment fix#245
OlufunbiIK merged 1 commit intomainfrom
cleaning-the-repo

Conversation

@OlufunbiIK
Copy link
Owner

@OlufunbiIK OlufunbiIK commented Mar 23, 2026

Summary by CodeRabbit

  • Chores
    • Configured Vercel deployment settings to streamline application builds and ensure proper routing for single-page application behavior.

@vercel
Copy link

vercel bot commented Mar 23, 2026

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

Project Deployment Actions Updated (UTC)
tip-tune Ready Ready Preview, Comment Mar 23, 2026 7:16pm

@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

A new Vercel configuration file was added to specify build and deployment settings for a Vite-based frontend application, including install and build commands, output directory, framework declaration, and routing rules.

Changes

Cohort / File(s) Summary
Vercel Deployment Configuration
vercel.json
Added configuration file specifying build commands to run within the frontend directory, output directory as frontend/dist, framework as vite, and a rewrite rule routing all requests to /index.html.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A config file hops into view,
Telling Vercel what to do—
Build and serve with Vite's speed,
Routes all handled—that's our creed!
Deployment dreams come true. 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix:deployment fix' is too vague and uses redundant terminology without clearly describing the actual change made to the codebase. Revise the title to be more descriptive and specific, such as 'Add Vercel configuration for Vite frontend deployment' or 'Configure Vercel build settings for frontend app'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleaning-the-repo

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@vercel.json`:
- Around line 6-11: The catch-all rewrite rule mapping source "/(.*)" to
"/index.html" is routing API calls (like the serviceWorker fetch to
"/api/push/subscribe") to the SPA HTML; update the rewrites so API routes are
excluded (allowing requests under "/api/*" and other backend paths to pass
through) by modifying the rewrites block—keep the existing rewrite for
client-side routes (destination "/index.html") but add a higher-priority rule or
exclusion for "/api/{path*}" (and any other backend prefixes) so the
"/api/push/subscribe" endpoint receives normal API requests instead of HTML.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd9b35ca-f41a-4390-87be-36986136db17

📥 Commits

Reviewing files that changed from the base of the PR and between 27237c5 and 4d3785c.

⛔ Files ignored due to path filters (3)
  • contracts/contracts/staking/Cargo.lock is excluded by !**/*.lock
  • contracts/tip-time-lock/Cargo.lock is excluded by !**/*.lock
  • contracts/tip-verification/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • vercel.json

Comment on lines +6 to +11
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for all API endpoint references in the frontend code

# Search for fetch calls with /api paths
rg -nP --type=ts --type=js --type=tsx --type=jsx -C3 'fetch\s*\(\s*[''"`]/api' frontend/

# Search for axios calls with /api paths
rg -nP --type=ts --type=js --type=tsx --type=jsx -C3 '(axios\.(get|post|put|delete|patch)|\.get|\.post|\.put|\.delete|\.patch)\s*\(\s*[''"`]/api' frontend/

# Search for any string literals containing /api/ paths
rg -nP --type=ts --type=js --type=tsx --type=jsx '[''"`]/api/[^''"`]+[''"`]' frontend/

Repository: OlufunbiIK/tip-tune

Length of output: 146


🏁 Script executed:

cat vercel.json

Repository: OlufunbiIK/tip-tune

Length of output: 319


🏁 Script executed:

#!/bin/bash
# Search for API endpoint references with corrected syntax
# Remove tsx/jsx types that rg doesn't recognize

# Search for fetch calls with /api paths
echo "=== Fetch calls to /api ==="
rg -n --type=ts --type=js -C2 'fetch\s*\(\s*[''"`]/api' frontend/

# Search for any string literals containing /api/ paths
echo -e "\n=== /api/ paths in strings ==="
rg -n --type=ts --type=js '[''"`]/api/[^''"`]+[''"`]' frontend/

# Also check for .ts files that might be API references
echo -e "\n=== Files in frontend with api in name or path ==="
fd -t f '\bapi' frontend/ 2>/dev/null || true

Repository: OlufunbiIK/tip-tune

Length of output: 200


🏁 Script executed:

# Check if there's a backend directory and what API structure exists
echo "=== Repository structure ==="
ls -la | head -20
echo -e "\n=== Frontend structure ==="
find frontend -type d -name 'api' -o -name 'services' -o -name 'utils' 2>/dev/null | head -10

Repository: OlufunbiIK/tip-tune

Length of output: 1369


🏁 Script executed:

cat frontend/src/utils/api.ts

Repository: OlufunbiIK/tip-tune

Length of output: 980


🏁 Script executed:

cat frontend/src/utils/serviceWorker.ts | head -60

Repository: OlufunbiIK/tip-tune

Length of output: 2257


🏁 Script executed:

# Check backend structure
ls -la backend/

Repository: OlufunbiIK/tip-tune

Length of output: 1903


🏁 Script executed:

# Search more broadly for API references and service usage
echo "=== Services directory ==="
find frontend/src/services -type f 2>/dev/null | head -20

echo -e "\n=== All files using the apiClient import ==="
rg -l "from.*api" frontend/src --type=ts --type=js

echo -e "\n=== All API endpoints called ==="
rg "'/api/" frontend/src --type=ts --type=js

Repository: OlufunbiIK/tip-tune

Length of output: 1136


🏁 Script executed:

# Check if there's a backend API listening on /api
grep -r "'/api" backend/src --include="*.ts" 2>/dev/null | head -10

Repository: OlufunbiIK/tip-tune

Length of output: 1172


🏁 Script executed:

# Check how VITE_API_BASE_URL is configured for production
echo "=== Frontend .env files ==="
find frontend -name ".env*" -type f 2>/dev/null

echo -e "\n=== Vite config files ==="
find frontend -name "vite.config.*" -type f

echo -e "\n=== Check vercel configuration or deployment docs ==="
find . -name "vercel.json" -o -name ".vercelignore" -o -name "vercel*.json" 2>/dev/null | xargs ls -la 2>/dev/null

# Check README or deployment docs for API configuration
echo -e "\n=== Looking for deployment/API configuration docs ==="
grep -r "VITE_API_BASE_URL\|API_BASE_URL" . --include="*.md" 2>/dev/null | head -5

Repository: OlufunbiIK/tip-tune

Length of output: 381


🏁 Script executed:

# Check a service file to understand how API calls are made
head -30 frontend/src/services/userService.ts

Repository: OlufunbiIK/tip-tune

Length of output: 778


Critical: Catch-all rewrite breaks the /api/push/subscribe endpoint.

The current rewrite rule routes all requests to /index.html, including the relative fetch call to /api/push/subscribe in frontend/src/utils/serviceWorker.ts. This will cause the push notification subscription to fail because the endpoint will receive HTML instead of a proper API response.

🔧 Proposed fix to exclude API routes from the rewrite
  "rewrites": [
+   {
+     "source": "/api/:path*",
+     "destination": "/api/:path*"
+   },
    {
      "source": "/(.*)",
      "destination": "/index.html"
    }
  ]

This ensures API routes are passed through to the backend while all other routes are handled by the SPA for client-side routing.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
"rewrites": [
{
"source": "/api/:path*",
"destination": "/api/:path*"
},
{
"source": "/(.*)",
"destination": "/index.html"
}
]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@vercel.json` around lines 6 - 11, The catch-all rewrite rule mapping source
"/(.*)" to "/index.html" is routing API calls (like the serviceWorker fetch to
"/api/push/subscribe") to the SPA HTML; update the rewrites so API routes are
excluded (allowing requests under "/api/*" and other backend paths to pass
through) by modifying the rewrites block—keep the existing rewrite for
client-side routes (destination "/index.html") but add a higher-priority rule or
exclusion for "/api/{path*}" (and any other backend prefixes) so the
"/api/push/subscribe" endpoint receives normal API requests instead of HTML.

@OlufunbiIK OlufunbiIK merged commit ca7e9d8 into main Mar 23, 2026
4 of 5 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