diff --git a/.env.example b/.env.example index 5055822..ed0d4a0 100644 --- a/.env.example +++ b/.env.example @@ -33,6 +33,8 @@ REDIS_TLS_ENABLED=false # --- Storage Settings --- # Choose your storage backend. Valid options are 'local' or 's3'. STORAGE_TYPE=local +# The maximum request body size to accept in bytes including while streaming. The body size can also be specified with a unit suffix for kilobytes (K), megabytes (M), or gigabytes (G). For example, 512K or 1M. Defaults to 512kb. Or the value of Infinity if you don't want any upload limit. +FRONTEND_BODY_SIZE_LIMIT=100M # --- Local Storage Settings --- # The path inside the container where files will be stored. diff --git a/packages/frontend/src/lib/components/custom/IngestionSourceForm.svelte b/packages/frontend/src/lib/components/custom/IngestionSourceForm.svelte index 1a91530..b085bb6 100644 --- a/packages/frontend/src/lib/components/custom/IngestionSourceForm.svelte +++ b/packages/frontend/src/lib/components/custom/IngestionSourceForm.svelte @@ -76,12 +76,11 @@ method: 'POST', body: uploadFormData }); - + const result = await response.json(); if (!response.ok) { - throw new Error('File upload failed'); + throw new Error(`File upload failed + ${result}`); } - const result = await response.json(); formData.providerConfig.uploadedFilePath = result.filePath; formData.providerConfig.uploadedFileName = file.name; console.log(formData.providerConfig.uploadedFilePath); @@ -91,7 +90,7 @@ setAlert({ type: 'error', title: 'Upload Failed', - message: 'PST file upload failed. Please try again.', + message: 'PST file upload failed. Please try again.' + error.message, duration: 5000, show: true }); diff --git a/packages/frontend/svelte.config.js b/packages/frontend/svelte.config.js index 03c17f2..4b4f698 100644 --- a/packages/frontend/svelte.config.js +++ b/packages/frontend/svelte.config.js @@ -1,12 +1,16 @@ import adapter from '@sveltejs/adapter-node'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; - +import 'dotenv/config'; /** @type {import('@sveltejs/kit').Config} */ const config = { // Consult https://svelte.dev/docs/kit/integrations // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter() } + kit: { + adapter: adapter({ + bodySizeLimit: process.env.FRONTEND_BODY_SIZE_LIMIT || '100M' + }) + } }; export default config;