Skip to content

Conversation

@piyushkdas0611
Copy link

Fix CI/CD Pipeline Build Failures

Overview

This PR addresses critical build failures in the CI/CD pipeline by fixing import path issues and making OAuth configurations optional for development environments.

Issues Fixed

The CI/CD pipeline was failing due to:

  1. Incorrect import paths causing module resolution errors
  2. Missing OAuth environment variables causing server startup failures

Changes Made

Commit 1: Fix NodeJS Fundamentals Import Path Case Sensitivity

File: client/src/App.jsx

  • Issue: Import path had incorrect casing - NodeJsFundamentals vs actual directory NodeJSFundamentals
  • Fix: Changed import path from "./pages/Notes/NodeJsFundamentals/NodeJsFundamentals.jsx" to "./pages/Notes/NodeJSFundamentals/NodeJSFundamentals.jsx"
  • Impact: Resolves Vite/Rollup build error: "Could not resolve './pages/Notes/NodeJsFundamentals/NodeJsFundamentals.jsx'"

Commit 2: Fix PasswordStrength Component Import Path

File: client/src/pages/Signup.jsx

  • Issue: Incorrect relative path depth for PasswordStrength component import
  • Fix: Changed import from "../../components/PasswordStrength" to "../components/PasswordStrength"
  • Impact: Resolves Vite/Rollup build error: "Could not resolve '../../components/PasswordStrength'"

Commit 3: Make OAuth Strategies Optional for Development

File: server/config/passport.js

  • Issue: Server failing to start due to missing OAuth environment variables (GITHUB_CLIENT_ID, GOOGLE_CLIENT_ID, etc.)
  • Fix: Wrapped OAuth strategy registrations with environment variable checks:
    • Google Login strategy only registers if GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_LOGIN_CALLBACK_URL are present
    • Google Signup strategy only registers if GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_SIGNUP_CALLBACK_URL are present
    • GitHub strategy only registers if GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, and GITHUB_LOGIN_CALLBACK_URL are present
  • Impact: Server can now start in development/CI environments without OAuth configuration

Technical Details

Build Errors Resolved

✗ Build failed in 753ms
error during build:
Could not resolve "./pages/Notes/NodeJsFundamentals/NodeJsFundamentals.jsx" from "src/App.jsx"
✗ Build failed in 5.37s  
error during build:
Could not resolve "../../components/PasswordStrength" from "src/pages/Signup.jsx"

Server Startup Error Resolved

TypeError: OAuth2Strategy requires a clientID option
    at Strategy.OAuth2Strategy (/server/node_modules/passport-oauth2/lib/strategy.js:87:34)

Testing

  • ✅ Client build now succeeds with no module resolution errors
  • ✅ Server starts successfully without OAuth environment variables
  • ✅ OAuth functionality remains intact when environment variables are provided
  • ✅ No breaking changes to existing functionality

Environment Compatibility

  • Development: Works without OAuth configuration
  • Production: OAuth strategies will register when environment variables are provided
  • CI/CD: Pipeline can now build and test without OAuth secrets

Files Modified

  1. client/src/App.jsx - Fixed NodeJS fundamentals import casing
  2. client/src/pages/Signup.jsx - Fixed PasswordStrength import path
  3. server/config/passport.js - Made OAuth strategies conditional

Breaking Changes

None. All changes are backward compatible and non-breaking.

Notes for Reviewers

  • The OAuth conditional loading includes helpful console logs for debugging
  • Import path fixes are case-sensitive corrections that align with actual file structure
  • Server gracefully handles missing OAuth configuration without affecting other functionality

@netlify
Copy link

netlify bot commented Oct 18, 2025

👷 Deploy request for codifylearn pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 60277f9

@github-actions
Copy link

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. Thank you @Roshansuthar1105 🙌🏼

@piyushkdas0611
Copy link
Author

Kindly do a thorough testing before merging to main and put the "hacktoberfest-accepted" label.

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