Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🚀 feat: Add support for custom AWS endpoint in S3 initialization (#6431)
Ruben Talstra692fba51d84c
diff --git a/.env.example b/.env.exampleindex d9a4d52d92..54f9c4a96c 100644--- a/.env.example+++ b/.env.example@@ -480,6 +480,7 @@ FIREBASE_APP_ID=# S3 AWS Bucket ##========================#+AWS_ENDPOINT_URL=AWS_ACCESS_KEY_ID=AWS_SECRET_ACCESS_KEY=AWS_REGION=diff --git a/api/server/services/Files/S3/initialize.js b/api/server/services/Files/S3/initialize.jsindex d85945f708..2daec25235 100644--- a/api/server/services/Files/S3/initialize.js+++ b/api/server/services/Files/S3/initialize.js@@ -9,6 +9,8 @@ let s3 = null;* If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are provided, they will be used.* Otherwise, the AWS SDK's default credentials chain (including IRSA) is used.*+ * If AWS_ENDPOINT_URL is provided, it will be used as the endpoint.+ ** @returns {S3Client|null} An instance of S3Client if the region is provided; otherwise, null.*/const initializeS3 = () => {@@ -22,18 +24,26 @@ const initializeS3 = () => {return null;}+ // Read the custom endpoint if provided.+ const endpoint = process.env.AWS_ENDPOINT_URL;const accessKeyId = process.env.AWS_ACCESS_KEY_ID;const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;+ const config = {+ region,+ // Conditionally add the endpoint if it is provided+ ...(endpoint ? { endpoint } : {}),+ };+if (accessKeyId && secretAccessKey) {s3 = new S3Client({- region,+ ...config,credentials: { accessKeyId, secretAccessKey },});logger.info('[initializeS3] S3 initialized with provided credentials.');} else {// When using IRSA, credentials are automatically provided via the IAM Role attached to the ServiceAccount.- s3 = new S3Client({ region });+ s3 = new S3Client(config);logger.info('[initializeS3] S3 initialized using default credentials (IRSA).');}