Skip to content

Commit

Permalink
build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario-SO committed Dec 19, 2024
1 parent 9033a2c commit 123faf5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/reel-creator/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,29 @@ import { VERSION } from "remotion/version";
* @type {import('@remotion/lambda').AwsRegion}
*/

const readSecretFile = (path) => {
if (process.env.NODE_ENV === 'development') {
const readSecretFile = async (path) => {
// During build time or when path is undefined, return the path itself
if (!path || process.env.NODE_ENV === 'development') {
return path;
}

// Only import fs when we actually need to read files
// This prevents issues during build time
const fs = await import('fs').then(m => m.default).catch(() => null);

if (!fs) {
console.warn('File system module not available, returning path as is');
return path;
}

try {
return fs.readFileSync(path, 'utf8').trim();
} catch (error) {
console.error(`Error reading secret file ${path}:`, error);
throw error;
return path; // Return path instead of throwing during build
}
};


export const REGION = "us-east-2";

export const SITE_NAME = 'rendering-engine';
Expand All @@ -28,4 +38,4 @@ export const TIMEOUT = 900;
export const SERVER_WEBHOOK_URL = process.env.SERVER_WEBHOOK_URL;
export const SERVER_WEBHOOK_SECRET_FILE = readSecretFile(process.env.SERVER_WEBHOOK_SECRET_FILE);
export const AWS_ACCESS_KEY_ID_FILE = readSecretFile(process.env.AWS_ACCESS_KEY_ID_FILE);
export const AWS_SECRET_ACCESS_KEY_FILE = readSecretFile(process.env.AWS_SECRET_ACCESS_KEY_FILE);
export const AWS_SECRET_ACCESS_KEY_FILE = readSecretFile(process.env.AWS_SECRET_ACCESS_KEY_FILE);

0 comments on commit 123faf5

Please sign in to comment.