Skip to content

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

🔧 fix: Potential Null Values for Custom Config

Danny Avila97085073d276
diff --git a/api/server/routes/config.js b/api/server/routes/config.js
index e50fb9f452..dd93037dd9 100644
--- a/api/server/routes/config.js
+++ b/api/server/routes/config.js
@@ -29,8 +29,6 @@ router.get('/', async function (req, res) {
return;
}
- const config = await getCustomConfig();
-
const isBirthday = () => {
const today = new Date();
return today.getMonth() === 1 && today.getDate() === 11;
@@ -102,7 +100,8 @@ router.get('/', async function (req, res) {
};
payload.mcpServers = {};
- if (config.mcpServers) {
+ const config = await getCustomConfig();
+ if (config?.mcpServers != null) {
for (const serverName in config.mcpServers) {
const serverConfig = config.mcpServers[serverName];
payload.mcpServers[serverName] = {
diff --git a/api/server/services/Config/getCustomConfig.js b/api/server/services/Config/getCustomConfig.js
index 0851b89a46..d1ee5c3278 100644
--- a/api/server/services/Config/getCustomConfig.js
+++ b/api/server/services/Config/getCustomConfig.js
@@ -57,7 +57,7 @@ const getCustomEndpointConfig = async (endpoint) => {
async function createGetMCPAuthMap() {
const customConfig = await getCustomConfig();
const mcpServers = customConfig?.mcpServers;
- const hasCustomUserVars = Object.values(mcpServers).some((server) => server.customUserVars);
+ const hasCustomUserVars = Object.values(mcpServers ?? {}).some((server) => server.customUserVars);
if (!hasCustomUserVars) {
return;
}