From 4e77e116563b6059e62e3f67e2e8c50907f671a6 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 12:43:19 +0530 Subject: [PATCH 01/31] add .env and github action for deploy --- .github/workflows/deploy-vercel.yml | 39 ++++++ README.md | 16 ++- src/app/(auth)/actions.ts | 2 +- src/app/(auth)/login/GoogleSignInButton.tsx | 5 +- src/app/(auth)/signup/actions.ts | 33 ++--- src/app/(main)/place/[placeId]/actions.ts | 131 +++++++++++--------- src/app/api/uploadthing/core.ts | 60 +++++---- src/app/api/validate.ts | 16 ++- src/auth.ts | 16 ++- src/components/posts/editor/actions.ts | 23 ++-- src/lib/ky.ts | 58 ++++++--- 11 files changed, 255 insertions(+), 144 deletions(-) create mode 100644 .github/workflows/deploy-vercel.yml diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml new file mode 100644 index 0000000..75873ca --- /dev/null +++ b/.github/workflows/deploy-vercel.yml @@ -0,0 +1,39 @@ +name: Deploy to Vercel + +on: + push: + branches: + - deploy # Trigger deployment on push to the 'deploy' branch + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" # Or your project's Node.js version + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} diff --git a/README.md b/README.md index 9c55e35..50e927e 100644 --- a/README.md +++ b/README.md @@ -81,12 +81,20 @@ Ensure you have the following installed: npm install prisma --save-dev ``` -2. **Set up your database connection:** +2. **Set up your environment variables:** - - Create a `.env` file in the root of your project with the following content: - ``` - DATABASE_URL="postgresql://user:password@localhost:5432/gotogether" + - This project uses environment variables for configuration. A template file `.env.example` is provided in the root directory. + - Copy this file to a new file named `.env`: + ```bash + cp .env.example .env ``` + - **Important**: Open the `.env` file and fill in the required values for your local development environment. This includes: + - `DATABASE_URL`: Your PostgreSQL connection string. For local development, it might look like `postgresql://YOUR_USER:YOUR_PASSWORD@localhost:5432/gotogether?schema=public`. If using Docker, the hostname might be `db` (e.g., `postgresql://user:password@db:5432/gotogether`). + - `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`: Your Google OAuth credentials. + - `UPLOADTHING_SECRET` and `NEXT_PUBLIC_UPLOADTHING_APP_ID`: Your UploadThing credentials. + - URLs for backend services (`NEXT_PUBLIC_BACKEND_URL`, `NEXT_PUBLIC_GO_BACKEND_URL`) if they differ from the defaults. + - Keycloak URLs if you are using a custom Keycloak instance. + - The `.env` file is already listed in `.gitignore` and should not be committed to your repository. 3. **Run Prisma migrations:** diff --git a/src/app/(auth)/actions.ts b/src/app/(auth)/actions.ts index 32e584e..a51e24d 100644 --- a/src/app/(auth)/actions.ts +++ b/src/app/(auth)/actions.ts @@ -20,6 +20,6 @@ export async function logout() { path: "/api/auth/refresh", maxAge: 0, }); - const keycloakLogoutUrl = `http://localhost:8084/realms/kong/protocol/openid-connect/logout?client_id=kong-oidc&post_logout_redirect_uri=http://localhost:3000/login`; + const keycloakLogoutUrl = `${process.env.NEXT_PUBLIC_KEYCLOAK_LOGOUT_URL || "http://localhost:8084/realms/kong/protocol/openid-connect/logout"}?client_id=kong-oidc&post_logout_redirect_uri=${process.env.NEXT_PUBLIC_KEYCLOAK_REDIRECT_URI || "http://localhost:3000/login"}`; return redirect(keycloakLogoutUrl); } diff --git a/src/app/(auth)/login/GoogleSignInButton.tsx b/src/app/(auth)/login/GoogleSignInButton.tsx index 84af2b9..917bf53 100644 --- a/src/app/(auth)/login/GoogleSignInButton.tsx +++ b/src/app/(auth)/login/GoogleSignInButton.tsx @@ -8,7 +8,10 @@ export default function GoogleSignInButton() { asChild > diff --git a/src/app/(auth)/signup/actions.ts b/src/app/(auth)/signup/actions.ts index fb10165..b228215 100644 --- a/src/app/(auth)/signup/actions.ts +++ b/src/app/(auth)/signup/actions.ts @@ -5,25 +5,29 @@ import { isRedirectError } from "next/dist/client/components/redirect"; import { redirect } from "next/navigation"; export async function signUp( - credentials: SignUpValues + credentials: SignUpValues, ): Promise<{ error: string } | void> { try { - const { username, email, password, firstName, lastName } = signUpSchema.parse(credentials); + const { username, email, password, firstName, lastName } = + signUpSchema.parse(credentials); // 👇 New: Call your Spring Boot backend API - const res = await fetch("http://localhost:8080/api/users/register", { - method: "POST", - headers: { - "Content-Type": "application/json", + const res = await fetch( + `${process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080"}/api/users/register`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + username, + email, + password, + firstName, // <-- Optional, you can ask these fields from user if needed + lastName, + }), }, - body: JSON.stringify({ - username, - email, - password, - firstName, // <-- Optional, you can ask these fields from user if needed - lastName, - }), - }); + ); if (!res.ok) { const err = await res.text(); @@ -32,7 +36,6 @@ export async function signUp( } return redirect("/login"); - } catch (error) { if (isRedirectError(error)) throw error; console.error(error); diff --git a/src/app/(main)/place/[placeId]/actions.ts b/src/app/(main)/place/[placeId]/actions.ts index 5a3e734..41d2ff7 100644 --- a/src/app/(main)/place/[placeId]/actions.ts +++ b/src/app/(main)/place/[placeId]/actions.ts @@ -1,70 +1,81 @@ "use server"; - import { goKyInstance } from "../../../../../src/lib/ky"; // Adjusted path to src/lib/ky - import type { PlaceDetailsResponse, PlaceDetails } from "@/types/location-types"; // Verify path +import { goKyInstance } from "../../../../../src/lib/ky"; // Adjusted path to src/lib/ky +import type { + PlaceDetailsResponse, + PlaceDetails, +} from "@/types/location-types"; // Verify path - interface GetPlaceDetailsResult { - success: boolean; - data?: PlaceDetails; // This is the 'result' object from PlaceDetailsResponse - error?: string; - status?: string; // To pass along Google's status like "NOT_FOUND", "INVALID_REQUEST" - } +interface GetPlaceDetailsResult { + success: boolean; + data?: PlaceDetails; // This is the 'result' object from PlaceDetailsResponse + error?: string; + status?: string; // To pass along Google's status like "NOT_FOUND", "INVALID_REQUEST" +} - export async function getPlaceDetailsByIdAction( - placeId: string, - ): Promise { - if (!placeId || placeId.trim() === "") { - return { success: false, error: "Place ID is required.", status: "INVALID_REQUEST_CLIENT" }; - } +export async function getPlaceDetailsByIdAction( + placeId: string, +): Promise { + if (!placeId || placeId.trim() === "") { + return { + success: false, + error: "Place ID is required.", + status: "INVALID_REQUEST_CLIENT", + }; + } - try { - // The API path is /maps/place/:place_id - // goKyInstance will append this to its prefixUrl: http://localhost:8000 - // So the final URL will be http://localhost:8000/maps/place/{placeId} - const response = await goKyInstance.get(`maps/place/${placeId}`).json(); + try { + // The API path is /maps/place/:place_id + // goKyInstance will append this to its prefixUrl (NEXT_PUBLIC_GO_BACKEND_URL, defaults to http://localhost:8083) + // So the final URL will be /maps/place/{placeId} + const response = await goKyInstance + .get(`maps/place/${placeId}`) + .json(); - // According to the API documentation for /maps/place/:place_id: - // - Success (200 OK) contains the PlaceDetailsResponse structure. - // - The 'status' field within the response body indicates Google's processing status. - // - Errors like 400, 403, 404, 429 are also possible from our backend, - // but ky throws HTTPError for non-2xx responses, which is caught below. - // If the backend wraps Google's error status (like NOT_FOUND) in a 200 OK response from *our* service, - // then we check response.status here. + // According to the API documentation for /maps/place/:place_id: + // - Success (200 OK) contains the PlaceDetailsResponse structure. + // - The 'status' field within the response body indicates Google's processing status. + // - Errors like 400, 403, 404, 429 are also possible from our backend, + // but ky throws HTTPError for non-2xx responses, which is caught below. + // If the backend wraps Google's error status (like NOT_FOUND) in a 200 OK response from *our* service, + // then we check response.status here. - if (response.status === "OK") { - return { success: true, data: response.result, status: response.status }; - } else { - // Handles cases like "ZERO_RESULTS", "NOT_FOUND", "INVALID_REQUEST" etc. - // returned by Google but wrapped in a 200 OK from our service. - console.error( - `API returned non-OK status for place ${placeId}: ${response.status} - ${response.error_message || ""}`, - ); - return { - success: false, - error: response.error_message || `API Error: ${response.status}`, - status: response.status, - }; - } - } catch (error: any) { - console.error(`Error fetching details for place ${placeId}:`, error); - let errorMessage = "Failed to fetch place details."; - let errorStatus = "UNKNOWN_ERROR_CLIENT"; + if (response.status === "OK") { + return { success: true, data: response.result, status: response.status }; + } else { + // Handles cases like "ZERO_RESULTS", "NOT_FOUND", "INVALID_REQUEST" etc. + // returned by Google but wrapped in a 200 OK from our service. + console.error( + `API returned non-OK status for place ${placeId}: ${response.status} - ${response.error_message || ""}`, + ); + return { + success: false, + error: response.error_message || `API Error: ${response.status}`, + status: response.status, + }; + } + } catch (error: any) { + console.error(`Error fetching details for place ${placeId}:`, error); + let errorMessage = "Failed to fetch place details."; + let errorStatus = "UNKNOWN_ERROR_CLIENT"; - if (error.name === 'HTTPError') { // Ky specific HTTP error - try { - const errorResponse = await error.response.json(); - // Assuming error response from our Go service might look like: - // { "error": "message", "details": "...", "status": "GOOGLE_STATUS_CODE" } - // or directly Google's PlaceDetailsResponse structure with a non-OK status. - errorMessage = errorResponse.error_message || errorResponse.error || error.message; - errorStatus = errorResponse.status || `HTTP_${error.response.status}`; - } catch (e) { - errorMessage = `API Error: ${error.response.status} - ${error.message}`; - errorStatus = `HTTP_${error.response.status}`; - } - } else if (error instanceof Error) { - errorMessage = error.message; - } - return { success: false, error: errorMessage, status: errorStatus }; + if (error.name === "HTTPError") { + // Ky specific HTTP error + try { + const errorResponse = await error.response.json(); + // Assuming error response from our Go service might look like: + // { "error": "message", "details": "...", "status": "GOOGLE_STATUS_CODE" } + // or directly Google's PlaceDetailsResponse structure with a non-OK status. + errorMessage = + errorResponse.error_message || errorResponse.error || error.message; + errorStatus = errorResponse.status || `HTTP_${error.response.status}`; + } catch (e) { + errorMessage = `API Error: ${error.response.status} - ${error.message}`; + errorStatus = `HTTP_${error.response.status}`; } + } else if (error instanceof Error) { + errorMessage = error.message; } + return { success: false, error: errorMessage, status: errorStatus }; + } +} diff --git a/src/app/api/uploadthing/core.ts b/src/app/api/uploadthing/core.ts index 4629606..da62795 100644 --- a/src/app/api/uploadthing/core.ts +++ b/src/app/api/uploadthing/core.ts @@ -9,8 +9,10 @@ export const fileRouter = { image: { maxFileSize: "512KB" }, }) .middleware(async ({ req }) => { - const cookieHeader = req.headers.get('cookie'); - const { user, token } = await validateRequest({ headers: { cookie: cookieHeader ?? undefined } }); + const cookieHeader = req.headers.get("cookie"); + const { user, token } = await validateRequest({ + headers: { cookie: cookieHeader ?? undefined }, + }); if (!user) throw new UploadThingError("Unauthorized"); return { user, token }; }) @@ -18,8 +20,14 @@ export const fileRouter = { const oldAvatarUrl = metadata?.user?.avatarUrl; // Clean up old avatar file from UploadThing if it exists - if (oldAvatarUrl?.includes(`/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/`)) { - const key = oldAvatarUrl.split(`/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/`)[1]; + if ( + oldAvatarUrl?.includes( + `/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/`, + ) + ) { + const key = oldAvatarUrl.split( + `/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/`, + )[1]; if (key) { await new UTApi().deleteFiles(key); } @@ -28,18 +36,21 @@ export const fileRouter = { // Build new avatar URL using UploadThing slug format const newAvatarUrl = file.url.replace( "/f/", - `/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/` + `/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/`, ); // Sync avatar update to Spring Boot backend - await fetch(`http://localhost:8080/api/users/${metadata.user.id}/avatar`, { - method: "PUT", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${metadata.token}`, + await fetch( + `${process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080"}/api/users/${metadata.user.id}/avatar`, + { + method: "PUT", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${metadata.token}`, + }, + body: JSON.stringify({ avatarUrl: newAvatarUrl }), }, - body: JSON.stringify({ avatarUrl: newAvatarUrl }), - }); + ); return { avatarUrl: newAvatarUrl }; }), @@ -49,10 +60,12 @@ export const fileRouter = { video: { maxFileSize: "64MB", maxFileCount: 5 }, }) .middleware(async ({ req }) => { - const cookieHeader = req.headers.get('cookie'); + const cookieHeader = req.headers.get("cookie"); // Assuming the second middleware also needs user and token, if not, it might just need to pass token if user is validated once. // For now, let's assume it also needs user for consistency or future use. - const { user, token } = await validateRequest({ headers: { cookie: cookieHeader ?? undefined } }); + const { user, token } = await validateRequest({ + headers: { cookie: cookieHeader ?? undefined }, + }); if (!user) throw new UploadThingError("Unauthorized"); return { token }; // This middleware only returns token, but validation implies user exists. }) @@ -60,17 +73,20 @@ export const fileRouter = { const mediaType = file.type.startsWith("image") ? "IMAGE" : "VIDEO"; const url = file.url.replace( "/f/", - `/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/` + `/a/${process.env.NEXT_PUBLIC_UPLOADTHING_APP_ID}/`, ); - const response = await fetch("http://localhost:8080/api/media", { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${metadata.token}`, + const response = await fetch( + `${process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080"}/api/media`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${metadata.token}`, + }, + body: JSON.stringify({ url, type: mediaType }), }, - body: JSON.stringify({ url, type: mediaType }), - }); + ); if (!response.ok) { throw new UploadThingError("Failed to create media record in backend."); diff --git a/src/app/api/validate.ts b/src/app/api/validate.ts index 364c016..89a0bc3 100644 --- a/src/app/api/validate.ts +++ b/src/app/api/validate.ts @@ -5,12 +5,13 @@ import { validateRequest } from "../../auth"; // Replace this with your actual user info fetch logic async function getUserInfo(accessToken: string) { const response = await fetch( - "http://localhost:8081/realms/kong/protocol/openid-connect/userinfo", + process.env.NEXT_PUBLIC_KEYCLOAK_USERINFO_ENDPOINT || + "http://localhost:8081/realms/kong/protocol/openid-connect/userinfo", { headers: { Authorization: `Bearer ${accessToken}`, }, - } + }, ); if (!response.ok) { @@ -20,7 +21,10 @@ async function getUserInfo(accessToken: string) { return await response.json(); } -export default async function handler(req: NextApiRequest, res: NextApiResponse) { - const { user } = await validateRequest(req); - return res.status(200).json({ user }); - } \ No newline at end of file +export default async function handler( + req: NextApiRequest, + res: NextApiResponse, +) { + const { user } = await validateRequest(req); + return res.status(200).json({ user }); +} diff --git a/src/auth.ts b/src/auth.ts index 90f2a53..6efa3c2 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -23,7 +23,9 @@ const adapter = { console.warn("Lucia adapter setSession not fully implemented."); }, updateSessionExpiration: async (sessionId: string, expiresAt: Date) => { - console.warn("Lucia adapter updateSessionExpiration not fully implemented."); + console.warn( + "Lucia adapter updateSessionExpiration not fully implemented.", + ); }, deleteSession: async (sessionId: string) => { console.warn("Lucia adapter deleteSession not fully implemented."); @@ -33,12 +35,12 @@ const adapter = { }, deleteExpiredSessions: async () => { console.warn("Lucia adapter deleteExpiredSessions not fully implemented."); - } + }, // You might also need setUser, updateUser, etc. depending on your adapter }; - -export const lucia = new Lucia(adapter as any, { // Cast as any due to placeholder +export const lucia = new Lucia(adapter as any, { + // Cast as any due to placeholder sessionCookie: { attributes: { secure: process.env.NODE_ENV === "production", @@ -60,12 +62,14 @@ export const lucia = new Lucia(adapter as any, { // Cast as any due to placehold export const google = new Google( process.env.GOOGLE_CLIENT_ID || "YOUR_GOOGLE_CLIENT_ID", // Fallback for build to pass process.env.GOOGLE_CLIENT_SECRET || "YOUR_GOOGLE_CLIENT_SECRET", // Fallback - process.env.GOOGLE_REDIRECT_URI || "http://localhost:3000/login/google/callback" // Fallback + process.env.NEXT_PUBLIC_GOOGLE_REDIRECT_URI || + "http://localhost:3000/login/google/callback", // Fallback ); export async function getUserInfo(accessToken: string) { const response = await fetch( - "http://localhost:8081/realms/kong/protocol/openid-connect/userinfo", + process.env.NEXT_PUBLIC_KEYCLOAK_USERINFO_ENDPOINT || + "http://localhost:8081/realms/kong/protocol/openid-connect/userinfo", { headers: { Authorization: `Bearer ${accessToken}`, diff --git a/src/components/posts/editor/actions.ts b/src/components/posts/editor/actions.ts index c86a3c7..65b67a0 100644 --- a/src/components/posts/editor/actions.ts +++ b/src/components/posts/editor/actions.ts @@ -10,22 +10,27 @@ export async function submitPost(input: { }) { const { caption, email, mediaIds } = createPostSchema.parse(input); - const response = await axios.post(`http://localhost:8080/api/posts/create`, { - email, - caption, - mediaIds, - }); + const response = await axios.post( + `${process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080"}/api/posts/create`, + { + email, + caption, + mediaIds, + }, + ); return response.data; } - export async function updatePost(input: { postId: string; caption: string }) { const { postId, caption } = input; - const response = await axios.put(`http://localhost:8080/api/posts/${postId}`, { - caption, - }); + const response = await axios.put( + `${process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080"}/api/posts/${postId}`, + { + caption, + }, + ); return response.data; } diff --git a/src/lib/ky.ts b/src/lib/ky.ts index 21e9db4..5a83742 100644 --- a/src/lib/ky.ts +++ b/src/lib/ky.ts @@ -10,7 +10,7 @@ let failedRequestsQueue: { }[] = []; const defaultOptions: Options = { - prefixUrl: "http://localhost:8080", + prefixUrl: process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8080", credentials: "include", parseJson: (text) => { if (!text || text.trim() === "") return null; @@ -53,7 +53,10 @@ const kyInstance = ky.create({ async (request, options, response) => { const requestUrl = new URL(request.url); // Get full URL for proper check // Check if it's a 401 and not a refresh attempt that failed - if (response.status === 401 && !requestUrl.pathname.endsWith("/api/auth/refresh")) { + if ( + response.status === 401 && + !requestUrl.pathname.endsWith("/api/auth/refresh") + ) { if (!isRefreshing) { isRefreshing = true; try { @@ -78,11 +81,13 @@ const kyInstance = ky.create({ // Retry the original request and all queued requests const originalRetry = ky(request); // Retry original first const queuedRetries = failedRequestsQueue.map( - (prom) => ky(prom.request) // Then retry queued + (prom) => ky(prom.request), // Then retry queued ); // Resolve all promises - failedRequestsQueue.forEach((prom, index) => prom.resolve(queuedRetries[index])); + failedRequestsQueue.forEach((prom, index) => + prom.resolve(queuedRetries[index]), + ); failedRequestsQueue = []; isRefreshing = false; return originalRetry; // Return the promise for the original request @@ -93,7 +98,9 @@ const kyInstance = ky.create({ await refreshResponse.text(), ); // Reject all queued requests - failedRequestsQueue.forEach((prom) => prom.reject(refreshResponse.clone())); // Clone response for multiple rejections + failedRequestsQueue.forEach((prom) => + prom.reject(refreshResponse.clone()), + ); // Clone response for multiple rejections failedRequestsQueue = []; isRefreshing = false; // If refresh fails, the original request's 401 response will be returned @@ -113,23 +120,34 @@ const kyInstance = ky.create({ // Token is already refreshing, queue this request console.log("Token is refreshing. Queuing request:", request.url); return new Promise((resolve, reject) => { - failedRequestsQueue.push({ resolve, reject, request: request.clone() }); // Clone request + failedRequestsQueue.push({ + resolve, + reject, + request: request.clone(), + }); // Clone request }); } - } else if (response.status === 401 && requestUrl.pathname.endsWith("/api/auth/refresh")) { - // This means the refresh token itself is invalid or expired. - console.error("Refresh token is invalid or expired. User needs to re-authenticate."); - isRefreshing = false; // Reset flag - // Reject all queued requests because refresh is impossible - failedRequestsQueue.forEach(prom => prom.reject(response.clone())); // Clone response - failedRequestsQueue = []; + } else if ( + response.status === 401 && + requestUrl.pathname.endsWith("/api/auth/refresh") + ) { + // This means the refresh token itself is invalid or expired. + console.error( + "Refresh token is invalid or expired. User needs to re-authenticate.", + ); + isRefreshing = false; // Reset flag + // Reject all queued requests because refresh is impossible + failedRequestsQueue.forEach((prom) => prom.reject(response.clone())); // Clone response + failedRequestsQueue = []; - // Redirect to login if refresh token is invalid - if (typeof window !== 'undefined') { - console.log('Redirecting to login page due to invalid refresh token.'); - window.location.href = '/login'; - } - return response; // Return the original 401 response for the refresh call + // Redirect to login if refresh token is invalid + if (typeof window !== "undefined") { + console.log( + "Redirecting to login page due to invalid refresh token.", + ); + window.location.href = "/login"; + } + return response; // Return the original 401 response for the refresh call } return response; // For non-401 responses }, @@ -139,7 +157,7 @@ const kyInstance = ky.create({ // New instance for Go backend (remains unchanged) export const goKyInstance = ky.create({ - prefixUrl: "http://localhost:8083", + prefixUrl: process.env.NEXT_PUBLIC_GO_BACKEND_URL || "http://localhost:8083", credentials: "include", parseJson: (text) => { if (!text || text.trim() === "") return null; From 4e5c7a55e364925b82662e6090eeeb0828df75b8 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:13:06 +0530 Subject: [PATCH 02/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 75873ca..996e4b8 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "18" # Or your project's Node.js version + node-version: "18" # Use your Node.js version - name: Install Vercel CLI run: npm install --global vercel@latest @@ -26,6 +26,9 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + - name: Install dependencies (force to bypass peer conflict) + run: npm install --force + - name: Build Project Artifacts run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} env: @@ -37,3 +40,4 @@ jobs: env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + From deac74fca30114792b00b6f2a61f276375285308 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:17:31 +0530 Subject: [PATCH 03/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 996e4b8..7c4bd14 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -26,8 +26,8 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - name: Install dependencies (force to bypass peer conflict) - run: npm install --force + - name: Install dependencies (legacy peer deps) + run: npm install --legacy-peer-deps - name: Build Project Artifacts run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} From 0e1a70225e35b09ba63578d06098d9fc577dc521 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:20:41 +0530 Subject: [PATCH 04/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 7c4bd14..279095a 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -3,7 +3,7 @@ name: Deploy to Vercel on: push: branches: - - deploy # Trigger deployment on push to the 'deploy' branch + - deploy jobs: deploy: @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "18" # Use your Node.js version + node-version: "18" - name: Install Vercel CLI run: npm install --global vercel@latest @@ -26,7 +26,7 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - name: Install dependencies (legacy peer deps) + - name: Install dependencies (using legacy-peer-deps) run: npm install --legacy-peer-deps - name: Build Project Artifacts From 04ace3c880b9ce19a85709446594fcc3ef5f9515 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:26:59 +0530 Subject: [PATCH 05/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 279095a..0de4459 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -26,7 +26,7 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - name: Install dependencies (using legacy-peer-deps) + - name: Install dependencies (with legacy peer deps) run: npm install --legacy-peer-deps - name: Build Project Artifacts @@ -41,3 +41,4 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + From 1f9bc6bc088bdae98d1e57e30d839fe62dfbc82f Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:30:51 +0530 Subject: [PATCH 06/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 0de4459..dbc7e50 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -42,3 +42,4 @@ jobs: VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + From f5ededea9edb2dbb0a341539dd8130f039f74fd5 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:34:51 +0530 Subject: [PATCH 07/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index dbc7e50..1b1fd60 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -3,11 +3,12 @@ name: Deploy to Vercel on: push: branches: - - deploy + - deploy # Trigger deployment on push to 'deploy' branch jobs: deploy: runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v3 @@ -15,7 +16,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "18" + node-version: "18" # Adjust if using a different version - name: Install Vercel CLI run: npm install --global vercel@latest @@ -29,6 +30,9 @@ jobs: - name: Install dependencies (with legacy peer deps) run: npm install --legacy-peer-deps + - name: Prevent Vercel CLI from reinstalling dependencies + run: echo "node_modules" > .vercelignore + - name: Build Project Artifacts run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} env: @@ -43,3 +47,4 @@ jobs: + From 78c776dcd8c01df2be0eee875c570006cc6b0c6e Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:39:29 +0530 Subject: [PATCH 08/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 1b1fd60..fd75a17 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -3,7 +3,7 @@ name: Deploy to Vercel on: push: branches: - - deploy # Trigger deployment on push to 'deploy' branch + - deploy jobs: deploy: @@ -16,7 +16,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "18" # Adjust if using a different version + node-version: "18" - name: Install Vercel CLI run: npm install --global vercel@latest @@ -27,24 +27,22 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - name: Install dependencies (with legacy peer deps) + - name: Install dependencies with legacy peer resolution run: npm install --legacy-peer-deps - - name: Prevent Vercel CLI from reinstalling dependencies - run: echo "node_modules" > .vercelignore + - name: Prevent Vercel CLI from reinstalling deps + run: | + echo "node_modules" > .vercelignore + echo ".vercel" >> .vercelignore - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts with existing deps + run: npx vercel build --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + run: npx vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - - - From d7fd9c506b1b04434e35d52aad1935b466b94b56 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 13:50:32 +0530 Subject: [PATCH 09/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index fd75a17..e3702c2 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -27,7 +27,7 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - name: Install dependencies with legacy peer resolution + - name: Install dependencies with legacy peer deps run: npm install --legacy-peer-deps - name: Prevent Vercel CLI from reinstalling deps @@ -35,14 +35,15 @@ jobs: echo "node_modules" > .vercelignore echo ".vercel" >> .vercelignore - - name: Build Project Artifacts with existing deps - run: npx vercel build --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - name: Deploy Project Artifacts to Vercel - run: npx vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + From 8d68db89fb2de0d3bd636546a4a074740ce0d1a2 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 15:35:34 +0530 Subject: [PATCH 10/31] add .vercilignore --- .github/workflows/deploy-vercel.yml | 1 - .vercelignore | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .vercelignore diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index e3702c2..2a91108 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -46,4 +46,3 @@ jobs: env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - diff --git a/.vercelignore b/.vercelignore new file mode 100644 index 0000000..99019c9 --- /dev/null +++ b/.vercelignore @@ -0,0 +1,6 @@ +# Add to your .vercelignore + +package.json +package-lock.json +node_modules +.vercel From 1aff86d04e4a509cf1fa02ebf347de1f5a511454 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando Date: Thu, 12 Jun 2025 15:41:52 +0530 Subject: [PATCH 11/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 2a91108..05d4e2a 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -21,6 +21,13 @@ jobs: - name: Install Vercel CLI run: npm install --global vercel@latest + - name: Print environment and versions + run: | + node -v + npm -v + npx vercel --version + cat package.json + - name: Pull Vercel Environment Information run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} env: @@ -34,9 +41,11 @@ jobs: run: | echo "node_modules" > .vercelignore echo ".vercel" >> .vercelignore + echo "package.json" >> .vercelignore + echo "package-lock.json" >> .vercelignore - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + run: npm exec vercel build -- --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} @@ -46,3 +55,4 @@ jobs: env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + From d5a613f3619cb70a120c4135fda1e552587e4d34 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 15:46:17 +0530 Subject: [PATCH 12/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 05d4e2a..8c2c445 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -16,17 +16,16 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "18" + node-version: "20.16.0" - name: Install Vercel CLI - run: npm install --global vercel@latest + run: npm install --global vercel@37.4.2 - name: Print environment and versions run: | node -v npm -v npx vercel --version - cat package.json - name: Pull Vercel Environment Information run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} From e332f633b4d4fd0543eb762a78c9af93a3497f55 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 15:54:29 +0530 Subject: [PATCH 13/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 8c2c445..51fd552 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -54,4 +54,3 @@ jobs: env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - From 328057a68fa77f5eb02da77fd8e0f53ece306a39 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 16:07:13 +0530 Subject: [PATCH 14/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 51fd552..a677411 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -18,7 +18,7 @@ jobs: with: node-version: "20.16.0" - - name: Install Vercel CLI + - name: Install Vercel CLI (working version) run: npm install --global vercel@37.4.2 - name: Print environment and versions @@ -43,14 +43,12 @@ jobs: echo "package.json" >> .vercelignore echo "package-lock.json" >> .vercelignore - - name: Build Project Artifacts - run: npm exec vercel build -- --prod --token=${{ secrets.VERCEL_TOKEN }} - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + - name: Build Project using Next.js + run: npm run build - name: Deploy Project Artifacts to Vercel run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + From f30148b3457a557e8ef12dc3288306a3510ef552 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:50:31 +0000 Subject: [PATCH 15/31] Fix: Resolve type error in PlaceDetailPage The 'HorizontalScrollBar' component expects 'cardData' with a 'vicinity' property of type 'string'. The 'relatedPlaces' data, of type 'PlaceDetails[]', had 'vicinity' as 'string | undefined'. This commit modifies 'src/app/(main)/place/[placeId]/page.tsx' to map over 'relatedPlaces' before passing it to 'HorizontalScrollBar'. If 'place.vicinity' is undefined, it now defaults to an empty string (""), ensuring compatibility with the expected 'LocationDetail[]' type and resolving the build error. --- src/app/(main)/place/[placeId]/page.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/(main)/place/[placeId]/page.tsx b/src/app/(main)/place/[placeId]/page.tsx index 0bff1fe..df0d4c8 100644 --- a/src/app/(main)/place/[placeId]/page.tsx +++ b/src/app/(main)/place/[placeId]/page.tsx @@ -400,7 +400,10 @@ export default function PlaceDetailPage({ params }: PlaceDetailPageProps) { ({ + ...place, + vicinity: place.vicinity || "", + }))} // relatedPlaces are PlaceDetails[], compatible with LocationDetail[] images={relatedPlaces.map(p => p.photo_urls?.[0] || DEFAULT_IMAGE_URL)} scrollButton={{ route: "" as any, loading: false }} // Effectively hides "See all" handleNavigation={() => {}} // Dummy function as "See all" is hidden From 06a2a27d6487e99e91797b55a7566204f8e2af3e Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 16:32:13 +0530 Subject: [PATCH 16/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index a677411..0a02940 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -47,7 +47,7 @@ jobs: run: npm run build - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} From 9c309eee7bbcc1c175f93c46e6e2b38bd8b1ed94 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 16:47:43 +0530 Subject: [PATCH 17/31] update vercle.json --- vercel.json | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vercel.json b/vercel.json index 74ab2ea..2a965b6 100644 --- a/vercel.json +++ b/vercel.json @@ -1,8 +1,5 @@ { - "crons": [ - { - "path": "/api/clear-uploads", - "schedule": "0 2 * * *" - } - ] + "buildCommand": "npm run build", + "outputDirectory": ".next", + "framework": "nextjs" } From 02fac0c3022ae1443c7883b57fac1c6767bf80c7 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 16:56:44 +0530 Subject: [PATCH 18/31] Update vercel.json --- vercel.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 2a965b6..9110421 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,12 @@ { + "framework": "nextjs", "buildCommand": "npm run build", "outputDirectory": ".next", - "framework": "nextjs" + "crons": [ + { + "path": "/api/clear-uploads", + "schedule": "0 2 * * *" + } + ] } + From 6303303cb551a09acbf1610b122f740e09b3bcec Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:03:33 +0530 Subject: [PATCH 19/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 0a02940..59a68bd 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -19,7 +19,7 @@ jobs: node-version: "20.16.0" - name: Install Vercel CLI (working version) - run: npm install --global vercel@37.4.2 + run: npm install --global vercel@latest - name: Print environment and versions run: | From f66ca8e5264466e485b8720cf148878c7973da9d Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:08:39 +0530 Subject: [PATCH 20/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 59a68bd..3ddb562 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -40,8 +40,8 @@ jobs: run: | echo "node_modules" > .vercelignore echo ".vercel" >> .vercelignore - echo "package.json" >> .vercelignore - echo "package-lock.json" >> .vercelignore + # echo "package.json" >> .vercelignore + # echo "package-lock.json" >> .vercelignore - name: Build Project using Next.js run: npm run build From e5a232cca3bba4e2fe9316e7840cad254b71b746 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:47:12 +0530 Subject: [PATCH 21/31] Update vercel.json --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 9110421..d86ebfa 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,6 @@ { "framework": "nextjs", - "buildCommand": "npm run build", + "buildCommand": "npm install --legacy-peer-deps && npm run build", "outputDirectory": ".next", "crons": [ { From 9ec103f1ae1a498cba4726fbc72485d70c01a715 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:48:23 +0530 Subject: [PATCH 22/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 3ddb562..30df26c 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -47,7 +47,7 @@ jobs: run: npm run build - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} From eab46c7065e0d0ca6563a2d7ad5db965b0162ba0 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:53:49 +0530 Subject: [PATCH 23/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 30df26c..93b8e62 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -43,8 +43,8 @@ jobs: # echo "package.json" >> .vercelignore # echo "package-lock.json" >> .vercelignore - - name: Build Project using Next.js - run: npm run build + - name: Build using Vercel CLI + run: npx vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} From ce9c7e32b6e6fe0465d0b2b7bba9a1a3bd6cbb07 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:54:23 +0530 Subject: [PATCH 24/31] Update vercel.json --- vercel.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vercel.json b/vercel.json index d86ebfa..7c54695 100644 --- a/vercel.json +++ b/vercel.json @@ -1,7 +1,7 @@ { "framework": "nextjs", - "buildCommand": "npm install --legacy-peer-deps && npm run build", - "outputDirectory": ".next", + "buildCommand": "npm run build", + "outputDirectory": ".vercel/output", "crons": [ { "path": "/api/clear-uploads", From 33932e1010baa231e38786baeea20212baf26523 Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:57:31 +0530 Subject: [PATCH 25/31] Update deploy-vercel.yml --- .github/workflows/deploy-vercel.yml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index 93b8e62..d505798 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -18,36 +18,23 @@ jobs: with: node-version: "20.16.0" - - name: Install Vercel CLI (working version) + - name: Install Vercel CLI run: npm install --global vercel@latest - - name: Print environment and versions + - name: Print environment info run: | node -v npm -v - npx vercel --version - - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + vercel --version - name: Install dependencies with legacy peer deps run: npm install --legacy-peer-deps - - name: Prevent Vercel CLI from reinstalling deps - run: | - echo "node_modules" > .vercelignore - echo ".vercel" >> .vercelignore - # echo "package.json" >> .vercelignore - # echo "package-lock.json" >> .vercelignore - - - name: Build using Vercel CLI - run: npx vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Build the project (Next.js) + run: npm run build - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy to Vercel + run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} From 9cf5bef6f2c89b81cf626a96316500773302fb3c Mon Sep 17 00:00:00 2001 From: Harshana Lakshara Fernando <2020thlf@gmail.com> Date: Thu, 12 Jun 2025 17:58:15 +0530 Subject: [PATCH 26/31] Update vercel.json --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 7c54695..9110421 100644 --- a/vercel.json +++ b/vercel.json @@ -1,7 +1,7 @@ { "framework": "nextjs", "buildCommand": "npm run build", - "outputDirectory": ".vercel/output", + "outputDirectory": ".next", "crons": [ { "path": "/api/clear-uploads", From c2854c4fa5f6c53eb5a305d732f56f8197573748 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 18:02:25 +0530 Subject: [PATCH 27/31] update --- .github/workflows/deploy-vercel.yml | 5 ++--- vercel.json | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index d505798..ee64479 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -30,12 +30,11 @@ jobs: - name: Install dependencies with legacy peer deps run: npm install --legacy-peer-deps - - name: Build the project (Next.js) + - name: Build with Next.js run: npm run build - name: Deploy to Vercel - run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} + run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} --confirm --yes env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - diff --git a/vercel.json b/vercel.json index 9110421..979504a 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,5 @@ { - "framework": "nextjs", + "framework": null, "buildCommand": "npm run build", "outputDirectory": ".next", "crons": [ @@ -9,4 +9,3 @@ } ] } - From 3a35fea915f6c018a0c68f54ba42d117f4577eef Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 18:12:06 +0530 Subject: [PATCH 28/31] update --- .gitignore | 2 +- .vercel/README.txt | 11 +++++++++++ .vercel/project.json | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .vercel/README.txt create mode 100644 .vercel/project.json diff --git a/.gitignore b/.gitignore index 5ef6a52..29ec709 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ yarn-error.log* .env* # vercel -.vercel +# .vercel # typescript *.tsbuildinfo diff --git a/.vercel/README.txt b/.vercel/README.txt new file mode 100644 index 0000000..525d8ce --- /dev/null +++ b/.vercel/README.txt @@ -0,0 +1,11 @@ +> Why do I have a folder named ".vercel" in my project? +The ".vercel" folder is created when you link a directory to a Vercel project. + +> What does the "project.json" file contain? +The "project.json" file contains: +- The ID of the Vercel project that you linked ("projectId") +- The ID of the user or team your Vercel project is owned by ("orgId") + +> Should I commit the ".vercel" folder? +No, you should not share the ".vercel" folder with anyone. +Upon creation, it will be automatically added to your ".gitignore" file. diff --git a/.vercel/project.json b/.vercel/project.json new file mode 100644 index 0000000..5297720 --- /dev/null +++ b/.vercel/project.json @@ -0,0 +1,15 @@ +{ + "projectId": "prj_te8nIZ8DyvHEtnS5zjg84EWRNhNo", + "orgId": "team_Hdro0YYN8FfVYjQGRSNOr3xB", + "settings": { + "createdAt": 1749712056965, + "framework": "nextjs", + "devCommand": null, + "installCommand": null, + "buildCommand": null, + "outputDirectory": null, + "rootDirectory": null, + "directoryListing": false, + "nodeVersion": "20.x" + } +} From 7bc9119219b906e2e3d72afd43b21a0d996786dd Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 18:20:35 +0530 Subject: [PATCH 29/31] update --- .github/workflows/deploy-vercel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index ee64479..e22fb84 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -34,7 +34,7 @@ jobs: run: npm run build - name: Deploy to Vercel - run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} --confirm --yes + run: vercel deploy --prod --yes --token=${{ secrets.VERCEL_TOKEN }} --confirm --yes env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} From 7197dc9be22070ffa7067dfd28f5be2fff4e8822 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 18:34:13 +0530 Subject: [PATCH 30/31] update --- .github/workflows/deploy-vercel.yml | 2 +- .vercelignore | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy-vercel.yml b/.github/workflows/deploy-vercel.yml index e22fb84..37facee 100644 --- a/.github/workflows/deploy-vercel.yml +++ b/.github/workflows/deploy-vercel.yml @@ -34,7 +34,7 @@ jobs: run: npm run build - name: Deploy to Vercel - run: vercel deploy --prod --yes --token=${{ secrets.VERCEL_TOKEN }} --confirm --yes + run: vercel deploy --prod --yes --token=${{ secrets.VERCEL_TOKEN }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} diff --git a/.vercelignore b/.vercelignore index 99019c9..0d6239b 100644 --- a/.vercelignore +++ b/.vercelignore @@ -1,6 +1,3 @@ # Add to your .vercelignore -package.json -package-lock.json node_modules -.vercel From 41f2faeeb8af319c7a1ada1e21a492bfd9e6bd38 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Thu, 12 Jun 2025 18:40:19 +0530 Subject: [PATCH 31/31] update --- vercel.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 979504a..a43e0ec 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,6 @@ { - "framework": null, + "framework": "nextjs", + "installCommand": "npm install --legacy-peer-deps", "buildCommand": "npm run build", "outputDirectory": ".next", "crons": [