Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions frontend/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ const withBundleAnalyzer = initializeBundleAnalyzer({
* Standalone/HA modes use REST API pattern via /api/* rewrites.
* Appwrite mode uses native Appwrite SDK (no backend API needed).
*/
// Debug: Log environment variables during build
console.log('[next.config.ts] Build-time environment check:');
console.log(' APPWRITE_SITE_API_ENDPOINT:', process.env.APPWRITE_SITE_API_ENDPOINT || 'NOT SET');
console.log(' APPWRITE_SITE_PROJECT_ID:', process.env.APPWRITE_SITE_PROJECT_ID || 'NOT SET');
console.log(' APPWRITE_ENDPOINT:', process.env.APPWRITE_ENDPOINT || 'NOT SET');
console.log(' APPWRITE_PROJECT_ID:', process.env.APPWRITE_PROJECT_ID || 'NOT SET');
console.log(' DEPLOYMENT_MODE:', process.env.DEPLOYMENT_MODE || 'NOT SET');
Comment on lines +28 to +34
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While these debug logs (and the ones on lines 47-48) are very helpful for diagnosing the current issue with environment variables, they should be removed once the problem is resolved. Leaving console.log statements in configuration files can lead to noisy build logs in production.

If you anticipate needing this for debugging in the future, consider wrapping all the diagnostic logging in a conditional check based on an environment variable:

if (process.env.DEBUG_CONFIG) {
  console.log('[next.config.ts] Build-time environment check:');
  console.log('  APPWRITE_SITE_API_ENDPOINT:', process.env.APPWRITE_SITE_API_ENDPOINT || 'NOT SET');
  // ... other logs ...
  console.log('[next.config.ts] Detected deployment mode:', deploymentMode);
  console.log('[next.config.ts] Will use output:', isAppwrite ? 'DEFAULT (no standalone)' : 'standalone');
}

This keeps the codebase clean while retaining the debugging utility when needed.


const isAppwriteSite = !!(
process.env.APPWRITE_SITE_API_ENDPOINT ||
process.env.APPWRITE_SITE_PROJECT_ID ||
Expand All @@ -36,6 +44,9 @@ const isStandalone = deploymentMode === 'standalone';
const isHomeAssistant = deploymentMode === 'homeassistant';
const isAppwrite = deploymentMode === 'appwrite';

console.log('[next.config.ts] Detected deployment mode:', deploymentMode);
console.log('[next.config.ts] Will use output:', isAppwrite ? 'DEFAULT (no standalone)' : 'standalone');

// Only standalone and HA modes need the appwrite stub (no direct SDK usage)
const require = createRequire(import.meta.url);
const standaloneAppwriteAlias = require.resolve('./src/lib/appwrite-standalone');
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dev": "next dev --turbopack",
"build": "next build --turbopack",
"postbuild": "if [ -d .next/standalone ]; then cp -r .next/static .next/standalone/.next/static && if [ -d public ]; then cp -r public .next/standalone/public; fi; fi",
"start": "node .next/standalone/server.js",
"start": "if [ -f .next/standalone/server.js ]; then node .next/standalone/server.js; else next start; fi",
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
Expand Down
Loading