mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Merge pull request #555 from R0m1k3/1.1
fix(server): fix form-data dynamic import for webhook invoice sending
This commit is contained in:
1 file changed
+13
-1
+13
-1
@@ -886,9 +886,21 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
size: parts.file.buffer.length
|
||||
});
|
||||
|
||||
// Import dynamique standard pour ESM (sans eval)
|
||||
// Import dynamique standard pour ESM (sans eval)
|
||||
const FormDataModule = await import('form-data');
|
||||
const FormData = FormDataModule.default;
|
||||
// Gestion robuste de l'import CJS/ESM : certains environnements retournent le constructeur directement, d'autres via .default
|
||||
const FormData = (FormDataModule.default || FormDataModule) as any;
|
||||
|
||||
console.log('🔍 INVOICE PROXY: FormData loaded', {
|
||||
type: typeof FormData,
|
||||
isConstructor: typeof FormData === 'function',
|
||||
hasDefault: !!FormDataModule.default
|
||||
});
|
||||
|
||||
if (typeof FormData !== 'function') {
|
||||
throw new Error(`Impossible de charger FormData (type reçu: ${typeof FormData})`);
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', parts.file.buffer, {
|
||||
|
||||
Reference in new issue
Block a user