Skip to content

Fix: Enable Vercel Deployment for All Contributors Without Individual Login Requirements#388

Merged
lmcrean merged 2 commits intomainfrom
feat-e2e-testing
Jun 26, 2025
Merged

Fix: Enable Vercel Deployment for All Contributors Without Individual Login Requirements#388
lmcrean merged 2 commits intomainfrom
feat-e2e-testing

Conversation

@lmcrean
Copy link
Owner

@lmcrean lmcrean commented Jun 26, 2025

#384 helps with this issue

this is a test, can only be validated by merging (need to see if @violaberg and other contributors can use deployment branches)

Problem

Contributors like @violaberg were unable to deploy their PRs to Vercel because the GitHub Actions workflow required individual Vercel authentication. The workflow was failing with:

see original em from #384

Run cd backend
Deploying backend to Vercel...
Vercel CLI 44.2.3
> NOTE: The Vercel CLI now collects telemetry regarding usage of the CLI.
> This information is used to shape the CLI roadmap and prioritize features.
> You can learn more, including how to opt-out if you'd not like to participate in this program, by visiting the following URL:
> https://vercel.com/docs/cli/about-telemetry
Error: No existing credentials found. Please run `vercel login` or pass "--token"
Learn More: https://err.sh/vercel/no-credentials-found
Error: Process completed with exit code 1.

Even though repository secrets were properly configured, the vercel pull command was failing in CI environments where projects aren't pre-linked.

Root Cause

The workflow was attempting to use vercel pull --yes --environment=preview which expects:

  1. Local project linking (which doesn't exist in fresh CI environments)
  2. Individual developer Vercel access (which contributors shouldn't need)

Solution

Enhanced the GitHub Actions workflow to work for all contributors using repository-level secrets only:

Backend Deployment Improvements:

  • Fallback Strategy: Try vercel pull first, but fallback to direct deployment if it fails
  • Manual Project Linking: Create .vercel/project.json with org/project IDs from repository secrets
  • Robust Error Handling: Continue deployment even if configuration sync fails

Frontend Deployment Improvements:

  • Simplified Deployment: Use direct deployment without requiring vercel pull
  • Proper Variable Injection: Ensure VITE_API_BASE_URL is correctly set from backend deployment
  • Consistent Project Linking: Manual .vercel/project.json creation for reliability

Changes Made

Before:

vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
vercel build --token=${{ secrets.VERCEL_TOKEN }}
DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})

After:

# Ensure .vercel directory exists and create project.json
mkdir -p .vercel
echo "{\"orgId\":\"$VERCEL_ORG_ID\",\"projectId\":\"$VERCEL_PROJECT_ID\"}" > .vercel/project.json

# Try vercel pull first, if it fails, proceed with direct deployment
if vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}; then
  echo "✅ Successfully pulled Vercel configuration"
  vercel build --token=${{ secrets.VERCEL_TOKEN }}
  DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
else
  echo "⚠️ Vercel pull failed, proceeding with direct deployment"
  DEPLOYMENT_URL=$(vercel deploy --token=${{ secrets.VERCEL_TOKEN }})
fi

Benefits

Universal Access: Any contributor can now trigger deployments
No Individual Setup: Contributors don't need Vercel accounts or CLI setup
Maintains Security: Uses encrypted repository secrets only
Follows CI/CD Best Practices: Backend deploys first, then frontend with proper URL injection
Backwards Compatible: Still works for existing deployment patterns

Testing Instructions

  1. Test with Contributor PR: Verify that @violaberg's PR Frontend(navbar): Enhance Mobile Navigation with Sheet Component #368 #384 now deploys successfully
  2. Test Repository Secrets: Confirm all required secrets are accessible:
    • VERCEL_TOKEN
    • VERCEL_ORG_ID
    • VERCEL_BACKEND_PROJECT_ID
    • VERCEL_FRONTEND_PROJECT_ID
  3. Test Integration: Verify frontend can communicate with deployed backend
  4. Test Branch URLs: Confirm deployments use branch-specific URLs for preview environments

Verification Steps

After merging, the workflow should:

  1. ✅ Deploy backend successfully for any contributor
  2. ✅ Deploy frontend with correct VITE_API_BASE_URL pointing to backend
  3. ✅ Generate unique preview URLs for each branch
  4. ✅ Pass integration tests between frontend and backend

Impact

  • Immediate: Fixes deployment failures for contributor PRs
  • Long-term: Enables seamless CI/CD for all team members
  • Security: Maintains secure deployment using repository secrets
  • Scalability: Supports multiple contributors without individual Vercel access management

Related Issues

Additional Notes

This change maintains all existing functionality while adding resilience for contributor workflows. Repository owners still manage Vercel access through GitHub repository secrets, ensuring secure and controlled deployments.


Ready for Review: This fix enables immediate deployment capability for all contributors while maintaining security and following established CI/CD patterns.

@vercel
Copy link

vercel bot commented Jun 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dottie-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 7:40pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
dottie ⬜️ Ignored (Inspect) Jun 26, 2025 7:40pm

…es gracefully, ensuring robust deployment process
@lmcrean lmcrean changed the title Enhance Vercel deployment workflow by creating .vercel directory and project.json for project linking Fix: Enable Vercel Deployment for All Contributors Without Individual Login Requirements Jun 26, 2025
@lmcrean lmcrean merged commit 0352fcd into main Jun 26, 2025
5 checks passed
@lmcrean lmcrean added this to Pipeline Jul 5, 2025
@lmcrean lmcrean removed this from Pipeline Jan 10, 2026
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