diff --git a/package.json b/package.json index 969f5c0..9774101 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start": "next start", "lint": "eslint", "check-config": "node --env-file=.env.local check_config.js", - "postinstall": "node patch_appwrite.js" + "prebuild": "node patch_appwrite.js" }, "dependencies": { "@livekit/components-react": "^2.9.21", diff --git a/src/lib/appwrite.server.ts b/src/lib/appwrite.server.ts index f38b110..06af964 100644 --- a/src/lib/appwrite.server.ts +++ b/src/lib/appwrite.server.ts @@ -1,6 +1,18 @@ import { Client, Account, Databases } from 'node-appwrite'; import { cookies } from 'next/headers'; +// Patch console.warn to suppress Appwrite version mismatch warning +if (typeof console !== 'undefined' && !(console as any)._appwritePatchedServer) { + const originalWarn = console.warn; + console.warn = (...args) => { + if (args[0] && typeof args[0] === 'string' && args[0].includes('The current SDK is built for Appwrite')) { + return; + } + originalWarn(...args); + }; + (console as any)._appwritePatchedServer = true; +} + const ENDPOINT = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || 'https://appwrite.almeira.com.co/v1'; const PROJECT_ID = process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID || '69b84df5003bd8957c5c'; const COOKIE_NAME = `a_session_${PROJECT_ID.toLowerCase()}`; diff --git a/src/lib/appwrite.ts b/src/lib/appwrite.ts index 0f882c2..989bc94 100644 --- a/src/lib/appwrite.ts +++ b/src/lib/appwrite.ts @@ -1,5 +1,17 @@ import { Client, Databases, Storage, Query, Account } from 'appwrite'; +// Patch console.warn to suppress Appwrite version mismatch warning +if (typeof console !== 'undefined' && !(console as any)._appwritePatchedClient) { + const originalWarn = console.warn; + console.warn = (...args) => { + if (args[0] && typeof args[0] === 'string' && args[0].includes('The current SDK is built for Appwrite')) { + return; + } + originalWarn(...args); + }; + (console as any)._appwritePatchedClient = true; +} + const client = new Client(); export const endpoint = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || 'https://appwrite.almeira.com.co/v1';