SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
batch err throwing modd
Ahmed Essam7b2289087f5d
diff --git a/packages/app/src/backend/middlewares/acl.mw.ts b/packages/app/src/backend/middlewares/acl.mw.tsindex e2804e41..841b0d03 100644--- a/packages/app/src/backend/middlewares/acl.mw.ts+++ b/packages/app/src/backend/middlewares/acl.mw.ts@@ -131,7 +131,7 @@ export async function pageACLCheck(if (rule?.access === 'rw' || rule?.access === 'r') {next();} else {- console.log('Forbidden: No valid access', req.url, rule);+ // console.log('Forbidden: No valid access', req.url, rule);return renderErrorPage(res, req, 403, 'Forbidden');}}diff --git a/packages/app/src/backend/middlewares/llmModelsLoader.mw.ts b/packages/app/src/backend/middlewares/llmModelsLoader.mw.tsindex e400cfbc..3e58e525 100644--- a/packages/app/src/backend/middlewares/llmModelsLoader.mw.ts+++ b/packages/app/src/backend/middlewares/llmModelsLoader.mw.ts@@ -3,7 +3,7 @@ import LLMHelper from '../services/LLMHelper';export async function llmModelsLoaderMiddleware(req: Request, res: Response, next: NextFunction) {res.locals.LLMModels = await LLMHelper.getUserLLMModels(req).catch((error) => {- console.error('Error fetching LLM models:', error);+ console.error('Error fetching LLM models:', error?.message);return [];});diff --git a/packages/app/src/backend/middlewares/oauthStrategy.mw.ts b/packages/app/src/backend/middlewares/oauthStrategy.mw.tsindex 5b8a5017..0a3bddae 100644--- a/packages/app/src/backend/middlewares/oauthStrategy.mw.ts+++ b/packages/app/src/backend/middlewares/oauthStrategy.mw.ts@@ -1,6 +1,6 @@import passport from 'passport';-import { strategyConfig } from '../routes/oauth/helper/strategyConfig';import { replaceTemplateVariablesOptimized } from '../routes/oauth/helper/oauthHelper';+import { strategyConfig } from '../routes/oauth/helper/strategyConfig';export const oauthStrategyInitialization = async (req, res, next) => {const { service, scope } = req.body;@@ -31,7 +31,7 @@ export const oauthStrategyInitialization = async (req, res, next) => {let config: any = { ...defaultConfig }; // Spread operator for shallow clone// Override default config with body parametersconst updatedReqBody = await replaceTemplateVariablesOptimized(req).catch((error) => {- console.log('error', error);+ console.log('error', error?.message);return { error };});@@ -49,7 +49,11 @@ export const oauthStrategyInitialization = async (req, res, next) => {const origin = req.headers?.origin || `${req.protocol}://${req.get('host')}`;const internalService = String(service).toLowerCase();const isOAuth2 = ['google', 'linkedin', 'oauth2'].includes(internalService);- const provider = isOAuth2 ? (internalService === 'oauth2' ? 'oauth2' : internalService) : 'oauth1';+ const provider = isOAuth2+ ? internalService === 'oauth2'+ ? 'oauth2'+ : internalService+ : 'oauth1';config['callbackURL'] = `${origin}/oauth/${provider}/callback`;} catch (e) {// leave as undefined if cannot derive@@ -76,7 +80,7 @@ export const oauthStrategyInitialization = async (req, res, next) => {next();} catch (error) {- console.error('Error configuring authentication strategy:', error);+ console.error('Error configuring authentication strategy:', error?.message);return res.status(500).send({ error: 'Internal server error while setting up authentication.' });diff --git a/packages/app/src/backend/routes/api/component/APIEndpoint.ts b/packages/app/src/backend/routes/api/component/APIEndpoint.tsindex 201baf0a..044e7feb 100644--- a/packages/app/src/backend/routes/api/component/APIEndpoint.ts+++ b/packages/app/src/backend/routes/api/component/APIEndpoint.ts@@ -1,6 +1,6 @@import { Router } from 'express';-import { smythAPIReq, authHeaders } from '../../../utils/';import * as userData from '../../../services/user-data.service';+import { authHeaders, smythAPIReq } from '../../../utils/';const router = Router();@@ -9,7 +9,7 @@ router.get('/domains', async (req, res) => {const result = await smythAPIReq.get('/domains?verified=true', await authHeaders(req));return res.json(result.data.domains);} catch (error) {- console.log('error', error);+ console.log('error', error?.message);return res.status(500).json({ error });}});diff --git a/packages/app/src/backend/routes/api/component/DataSourceCleaner.ts b/packages/app/src/backend/routes/api/component/DataSourceCleaner.tsindex 90f45ec2..cb6aed13 100644--- a/packages/app/src/backend/routes/api/component/DataSourceCleaner.ts+++ b/packages/app/src/backend/routes/api/component/DataSourceCleaner.ts@@ -8,7 +8,7 @@ router.get('/namespaces', async (req, res) => {const result = await smythAPIReq.get('/vectors/namespaces', await authHeaders(req));return res.json(result.data.namespaces);} catch (error) {- // console.log('error', error);+ // console.log('error', error?.message);return res.status(500).json({ error });}});diff --git a/packages/app/src/backend/routes/api/component/DataSourceIndexer.ts b/packages/app/src/backend/routes/api/component/DataSourceIndexer.tsindex 5d362233..0a338672 100644--- a/packages/app/src/backend/routes/api/component/DataSourceIndexer.ts+++ b/packages/app/src/backend/routes/api/component/DataSourceIndexer.ts@@ -1,7 +1,5 @@import { Router } from 'express';-import config from '../../../config';-import axios from 'axios';-import { smythAPIReq, authHeaders } from '../../../utils';+import { authHeaders, smythAPIReq } from '../../../utils';const router = Router();@@ -10,7 +8,7 @@ router.get('/namespaces', async (req, res) => {const result = await smythAPIReq.get('/vectors/namespaces', await authHeaders(req));return res.json(result.data.namespaces);} catch (error) {- console.log('error', error);+ console.log('error', error?.message);return res.status(500).json({ error });}});diff --git a/packages/app/src/backend/routes/api/component/DataSourceLookup.ts b/packages/app/src/backend/routes/api/component/DataSourceLookup.tsindex cb22e5d6..ab046eaa 100644--- a/packages/app/src/backend/routes/api/component/DataSourceLookup.ts+++ b/packages/app/src/backend/routes/api/component/DataSourceLookup.ts@@ -1,7 +1,5 @@import { Router } from 'express';-import config from '../../../config';-import axios from 'axios';-import { smythAPIReq, authHeaders } from '../../../utils/';+import { authHeaders, smythAPIReq } from '../../../utils/';const router = Router();@@ -10,7 +8,7 @@ router.get('/namespaces', async (req, res) => {const result = await smythAPIReq.get('/vectors/namespaces', await authHeaders(req));return res.json(result.data.namespaces);} catch (error) {- console.log('error', error);+ console.log('error', error?.message);return res.status(500).json({ error });}});diff --git a/packages/app/src/backend/routes/api/component/GoogleSheet.ts b/packages/app/src/backend/routes/api/component/GoogleSheet.tsindex 252ca43b..9fd0099a 100644--- a/packages/app/src/backend/routes/api/component/GoogleSheet.ts+++ b/packages/app/src/backend/routes/api/component/GoogleSheet.ts@@ -1,5 +1,5 @@import { Router } from 'express';-import { google, sheets_v4, Auth } from 'googleapis';+import { Auth, google, sheets_v4 } from 'googleapis';import config from '../../../config';const router: Router = Router();@@ -76,7 +76,7 @@ router.post('/getSheetNames', async (req: any, res: any) => {res.json(sheetNamesAndIds);} catch (error) {- console.error('Error fetching sheet names:', error);+ console.error('Error fetching sheet names:', error?.message);res.status(500).json({ error: 'Internal server error' });}}); // function ends herediff --git a/packages/app/src/backend/routes/api/page/agent-settings.ts b/packages/app/src/backend/routes/api/page/agent-settings.tsindex 2be93bcb..ced33b9f 100644--- a/packages/app/src/backend/routes/api/page/agent-settings.ts+++ b/packages/app/src/backend/routes/api/page/agent-settings.ts@@ -218,7 +218,7 @@ router.post(return res.json({ success: true, url: publicUrl });} catch (error) {- console.log('Error generating avatar', error);+ console.log('Error generating avatar', error?.message);return res.status(500).json({ error: 'Internal Server Error' });}},diff --git a/packages/app/src/backend/routes/api/page/builder.ts b/packages/app/src/backend/routes/api/page/builder.tsindex 30846532..69874bd2 100644--- a/packages/app/src/backend/routes/api/page/builder.ts+++ b/packages/app/src/backend/routes/api/page/builder.ts@@ -55,7 +55,7 @@ router.get('/domains', async (req, res) => {const result = await smythAPIReq.get('/domains?verified=true', await authHeaders(req));return res.json(result.data.domains);} catch (error) {- // console.log('error', error);+ // console.log('error', error?.message);return res.status(error?.response?.status || 500).json({ error: error?.message });}});@@ -71,7 +71,7 @@ router.post('/removeDomain', async (req, res) => {}return res.json({ success: true });} catch (error) {- console.log('error', error);+ console.log('error', error?.message);return res.status(error?.status || error?.response?.status || 500).json({ error: error?.message });@@ -108,7 +108,7 @@ router.post('/updateDomain', async (req, res) => {return res.json({ success: true });} catch (error) {- console.log('error', error);+ console.log('error', error?.message);return res.status(error?.status || error?.response?.status || 500).json({ error: error?.message });@@ -371,7 +371,7 @@ router.get('/integrations', async (req, res) => {const integrations = await getIntegrations();return res.json({ success: true, data: integrations });} catch (error) {- console.error('Error loading integrations:', error);+ console.error('Error loading integrations:', error?.message);return res.status(500).json({success: false,error: 'Error loading integrations',@@ -448,7 +448,7 @@ router.post('/data/generate-form-data', generateFormDataRateLim, async (req, resconst response = await smythAPIReq.get(`/ai-agent/${agentId}`, await authHeaders(req)).catch((error) => {- // console.error('Error getting agent data:', error);+ // console.error('Error getting agent data:', error?.message);throw error;});@@ -653,7 +653,7 @@ router.get('/llm-models', includeTeamDetails, async (req, res) => {res.locals.LLMModels = await LLMHelper.getUserLLMModels(req);res.status(200).json({ success: true, LLMModels: res.locals.LLMModels });} catch (error) {- console.error('Error refreshing LLM models:', error);+ console.error('Error refreshing LLM models:', error?.message);res.status(500).json({ success: false, error: 'Error refreshing LLM models' });}});@@ -699,12 +699,12 @@ router.put('/custom-llm', includeTeamDetails, customLLMAccessMw, async (req, res// delete the custom LLM model cacheawait cacheClient.del(config.cache.getCustomModelsCacheKey(teamId)).catch((error) => {- console.warn('Error deleting custom LLM model cache:', error);+ console.warn('Error deleting custom LLM model cache:', error?.message);});res.status(200).json({ success: true, data: saveCustomLLM.data });} catch (error) {- console.error('Error saving custom LLM model:', error);+ console.error('Error saving custom LLM model:', error?.message);res.status(500).json({ success: false, error: 'Error saving custom LLM model.' });}@@ -780,7 +780,7 @@ router.delete(// delete the custom LLM model cacheawait cacheClient.del(config.cache.getCustomModelsCacheKey(teamId)).catch((error) => {- console.warn('Error deleting custom LLM model cache:', error);+ console.warn('Error deleting custom LLM model cache:', error?.message);});res.status(200).json({ success: true, data: deleteModel.data });@@ -956,7 +956,7 @@ async function getBillingData(req, teamId: string): Promise<BillingData> {return billingData;} catch (error) {- console.warn('Error in refreshUsageCache:', error);+ console.warn('Error in refreshUsageCache:', error?.message);throw error;}}@@ -1226,7 +1226,7 @@ router.post(});apiResponse.data.on('error', (error) => {- //console.error('Stream error:', error);+ //console.error('Stream error:', error?.message);res.write(JSON.stringify({ content: 'Stream error occurred', _type: 'error' }) + '¨');res.end();});@@ -1313,7 +1313,7 @@ router.post('/check-limit-reached', async (req, res) => {return res.status(200).json({ success: true, exists: exists === 1 });} catch (error) {- console.error('Error checking limit reached data:', error);+ console.error('Error checking limit reached data:', error?.message);return res.status(500).json({ success: false, error: 'Error checking limit reached data' });}});@@ -1351,7 +1351,7 @@ router.post('/store-limit-reached', async (req, res) => {});}} catch (error) {- console.error('Error storing limit reached data:', error);+ console.error('Error storing limit reached data:', error?.message);return res.status(500).json({success: false,error: 'Error storing limit reached data',diff --git a/packages/app/src/backend/routes/api/page/chat.ts b/packages/app/src/backend/routes/api/page/chat.tsindex 48b25f3c..e629d2b0 100644--- a/packages/app/src/backend/routes/api/page/chat.ts+++ b/packages/app/src/backend/routes/api/page/chat.ts@@ -273,7 +273,7 @@ router.delete('/deleteFile', [includeTeamDetails], async (req, res) => {await assetStorage.deleteContent({ key });return res.json({ success: true });} catch (error) {- console.error('Error deleting file:', error);+ console.error('Error deleting file:', error?.message);return res.status(500).json({ error: 'Failed to delete file' });}});diff --git a/packages/app/src/backend/routes/api/page/feedback.ts b/packages/app/src/backend/routes/api/page/feedback.tsindex 45624046..b567a3a0 100644--- a/packages/app/src/backend/routes/api/page/feedback.ts+++ b/packages/app/src/backend/routes/api/page/feedback.ts@@ -7,16 +7,16 @@ router.post('/submit', async (req, res) => {try {const { feedbackData, userEmail } = req.body;const result = await submitFeedbackForm(feedbackData, userEmail);-+if (!result) {return res.status(400).json({ success: false, error: 'Failed to submit feedback' });}-+res.json(result);} catch (error) {- console.error('Error in feedback submission:', error);+ console.error('Error in feedback submission:', error?.message);res.status(500).json({ success: false, error: 'Internal server error' });}});-export const feedbackRouter = router;\ No newline at end of file+export const feedbackRouter = router;diff --git a/packages/app/src/backend/routes/api/page/vault.ts b/packages/app/src/backend/routes/api/page/vault.tsindex a475094d..30ab6773 100644--- a/packages/app/src/backend/routes/api/page/vault.ts+++ b/packages/app/src/backend/routes/api/page/vault.ts@@ -238,9 +238,18 @@ function sanitizeOAuthConnections(connections: any): any {if (!obj || typeof obj !== 'object') return;// List of sensitive field names to sanitize- const sensitiveFields = ['primary', 'secondary', 'expires_in', 'refresh_token',- 'access_token', 'accessToken', 'refreshToken', 'token',- 'tokenSecret', 'accessTokenSecret'];+ const sensitiveFields = [+ 'primary',+ 'secondary',+ 'expires_in',+ 'refresh_token',+ 'access_token',+ 'accessToken',+ 'refreshToken',+ 'token',+ 'tokenSecret',+ 'accessTokenSecret',+ ];for (const field of sensitiveFields) {if (obj[field] && typeof obj[field] === 'string' && obj[field] !== '[REDACTED]') {@@ -250,18 +259,34 @@ function sanitizeOAuthConnections(connections: any): any {// Also check for any field that looks like a token (JWT pattern or long string)// Exclude fields that are meant to be visible like clientID, clientSecret, consumerKey, etc.- const excludedFields = ['clientID', 'clientSecret', 'consumerKey', 'consumerSecret',- 'oauth_keys_prefix', 'name', 'platform', 'service', 'type',- 'scope', 'authorizationURL', 'tokenURL', 'requestTokenURL',- 'accessTokenURL', 'userAuthorizationURL'];+ const excludedFields = [+ 'clientID',+ 'clientSecret',+ 'consumerKey',+ 'consumerSecret',+ 'oauth_keys_prefix',+ 'name',+ 'platform',+ 'service',+ 'type',+ 'scope',+ 'authorizationURL',+ 'tokenURL',+ 'requestTokenURL',+ 'accessTokenURL',+ 'userAuthorizationURL',+ ];for (const [fieldName, fieldValue] of Object.entries(obj)) {- if (typeof fieldValue === 'string' &&+ if (+ typeof fieldValue === 'string' &&fieldValue.length > 40 &&!excludedFields.includes(fieldName) &&- fieldValue !== '[REDACTED]') {+ fieldValue !== '[REDACTED]'+ ) {// This might be a token - check for JWT pattern or OAuth token pattern- const looksLikeToken = fieldValue.includes('.') || // JWT (has dots)+ const looksLikeToken =+ fieldValue.includes('.') || // JWT (has dots)fieldValue.match(/^[A-Za-z0-9_-]{40,}$/); // OAuth token patternif (looksLikeToken) {obj[fieldName] = '[REDACTED]';@@ -276,7 +301,10 @@ function sanitizeOAuthConnections(connections: any): any {}// Sanitize auth_settings (might exist in legacy or contain misplaced tokens)- if (sanitizedConnection.auth_settings && typeof sanitizedConnection.auth_settings === 'object') {+ if (+ sanitizedConnection.auth_settings &&+ typeof sanitizedConnection.auth_settings === 'object'+ ) {sanitizeTokenFields(sanitizedConnection.auth_settings, 'auth_settings');}@@ -294,7 +322,9 @@ router.get('/oauth-connections', includeTeamDetails, async (req, res) => {const settings = await getTeamSettingsObj(req, OAUTH_SETTING_KEY);if (settings === null) {console.error('Failed to get OAuth settings due to an internal error.');- return res.status(500).json({ success: false, error: 'Failed to retrieve OAuth connections.' });+ return res+ .status(500)+ .json({ success: false, error: 'Failed to retrieve OAuth connections.' });}// Parse any stringified entries before sanitization@@ -327,8 +357,13 @@ router.get('/oauth-connections', includeTeamDetails, async (req, res) => {const sanitizedSettings = sanitizeOAuthConnections(parsedSettings);res.json(sanitizedSettings);} catch (error) {- console.error('Error fetching OAuth connections:', error);- res.status(500).json({ success: false, error: 'An unexpected error occurred while fetching OAuth connections.' });+ console.error('Error fetching OAuth connections:', error?.message);+ res+ .status(500)+ .json({+ success: false,+ error: 'An unexpected error occurred while fetching OAuth connections.',+ });}});@@ -336,12 +371,19 @@ router.put('/oauth-connections', includeTeamDetails, async (req, res) => {const { entryId, data: newSettings } = req.body;// Validate entryId format- if (!entryId || typeof entryId !== 'string' || !entryId.startsWith('OAUTH_') || !entryId.endsWith('_TOKENS')) {+ if (+ !entryId ||+ typeof entryId !== 'string' ||+ !entryId.startsWith('OAUTH_') ||+ !entryId.endsWith('_TOKENS')+ ) {return res.status(400).json({ success: false, error: 'Invalid or missing entryId.' });}// Validate incoming settings data (basic check)if (!newSettings || typeof newSettings !== 'object' || Array.isArray(newSettings)) {- return res.status(400).json({ success: false, error: 'Invalid or missing connection settings data.' });+ return res+ .status(400)+ .json({ success: false, error: 'Invalid or missing connection settings data.' });}try {@@ -349,53 +391,85 @@ router.put('/oauth-connections', includeTeamDetails, async (req, res) => {const existingSettingsMap = await getTeamSettingsObj(req, OAUTH_SETTING_KEY);if (existingSettingsMap === null) {// Handle case where fetching settings failed (getTeamSettingsObj handles internal errors)- return res.status(500).json({ success: false, error: 'Failed to retrieve existing OAuth settings.' });+ return res+ .status(500)+ .json({ success: false, error: 'Failed to retrieve existing OAuth settings.' });}// 2. Get the specific entry being updated, parse if string, or default to an empty object- let existingEntry = safeJsonParse(existingSettingsMap[entryId], {}, `OAuth PUT existingEntry ${entryId}`);+ let existingEntry = safeJsonParse(+ existingSettingsMap[entryId],+ {},+ `OAuth PUT existingEntry ${entryId}`,+ );// 3. Parse incoming newSettings if it's a string (shouldn't happen, but defensive coding)- const parsedNewSettings = safeJsonParse(newSettings, newSettings, `OAuth PUT newSettings ${entryId}`);+ const parsedNewSettings = safeJsonParse(+ newSettings,+ newSettings,+ `OAuth PUT newSettings ${entryId}`,+ );// 4. Preserve existing auth_data (if it exists) OR migrate from old structurelet preservedAuthData = existingEntry.auth_data || {}; // Keep existing tokens// If auth_data is empty but tokens exist at root level (old structure), migrate them- if ((!preservedAuthData.primary && !preservedAuthData.secondary) &&- (existingEntry.primary || existingEntry.secondary)) {+ if (+ !preservedAuthData.primary &&+ !preservedAuthData.secondary &&+ (existingEntry.primary || existingEntry.secondary)+ ) {// console.log('[OAuth Edit] Migrating tokens from old structure to new auth_data');preservedAuthData = {primary: existingEntry.primary || '',secondary: existingEntry.secondary || '',- expires_in: existingEntry.expires_in || ''+ expires_in: existingEntry.expires_in || '',};}// 5. Merge and normalize the settings using helper (now both are guaranteed to be objects)const mergedAuthSettings = mergeAuthSettings(existingEntry, parsedNewSettings);// 6. Parse preservedAuthData if it's somehow still a string (defensive coding)- preservedAuthData = safeJsonParse(preservedAuthData, {}, `OAuth PUT preservedAuthData ${entryId}`);+ preservedAuthData = safeJsonParse(+ preservedAuthData,+ {},+ `OAuth PUT preservedAuthData ${entryId}`,+ );// 7. Check if authentication-critical fields changed - if so, invalidate tokens// Handle both new structure (auth_settings.oauth_info) and legacy structure (oauth_info at root)- const existingOAuthInfo = existingEntry.auth_settings?.oauth_info || existingEntry.oauth_info || {};- const newOAuthInfo = mergedAuthSettings.oauth_info || mergedAuthSettings.auth_settings?.oauth_info || {};+ const existingOAuthInfo =+ existingEntry.auth_settings?.oauth_info || existingEntry.oauth_info || {};+ const newOAuthInfo =+ mergedAuthSettings.oauth_info || mergedAuthSettings.auth_settings?.oauth_info || {};const authCriticalFields = [- 'clientID', 'clientSecret', 'scope', 'authorizationURL', 'tokenURL',- 'consumerKey', 'consumerSecret', 'requestTokenURL', 'accessTokenURL', 'userAuthorizationURL',- 'service'+ 'clientID',+ 'clientSecret',+ 'scope',+ 'authorizationURL',+ 'tokenURL',+ 'consumerKey',+ 'consumerSecret',+ 'requestTokenURL',+ 'accessTokenURL',+ 'userAuthorizationURL',+ 'service',];// Enhanced comparison for authentication-critical fields- const hasAuthCriticalChanges = authCriticalFields.some(field => {+ const hasAuthCriticalChanges = authCriticalFields.some((field) => {// Get values from both possible locations for existing dataconst oldValueFromOAuthInfo = existingOAuthInfo[field];const oldValueFromRoot = existingEntry[field]; // Legacy structure stores some fields at rootconst oldValueFromAuthSettings = existingEntry.auth_settings?.[field]; // New structure fields- const oldValue = oldValueFromOAuthInfo !== undefined ? oldValueFromOAuthInfo :- (oldValueFromAuthSettings !== undefined ? oldValueFromAuthSettings : oldValueFromRoot);- // Get values from both possible locations for new data+ const oldValue =+ oldValueFromOAuthInfo !== undefined+ ? oldValueFromOAuthInfo+ : oldValueFromAuthSettings !== undefined+ ? oldValueFromAuthSettings+ : oldValueFromRoot;+ // Get values from both possible locations for new dataconst newValueFromOAuthInfo = newOAuthInfo[field];const newValueFromSettings = mergedAuthSettings[field]; // New data might be at root of mergedAuthSettings- const newValue = newValueFromOAuthInfo !== undefined ? newValueFromOAuthInfo : newValueFromSettings;+ const newValue =+ newValueFromOAuthInfo !== undefined ? newValueFromOAuthInfo : newValueFromSettings;// Normalize values: treat undefined, null, empty string, and whitespace as equivalentconst normalizeValue = (val) => {if (val === undefined || val === null || val === '') return '';@@ -411,7 +485,6 @@ router.put('/oauth-connections', includeTeamDetails, async (req, res) => {return hasChanged;});-// 8. Construct the final data object with the new structure// Clear tokens if auth-critical fields changed, otherwise preserve themconst finalDataToSave = {@@ -429,36 +502,59 @@ router.put('/oauth-connections', includeTeamDetails, async (req, res) => {// 10. Handle save resultif (!result.success) {- console.error(`[PUT /oauth-connections] Failed to save settings for ${entryId}:`, result.error);- return res.status(500).json({ success: false, error: result.error || 'Failed to save OAuth connection.' });+ console.error(+ `[PUT /oauth-connections] Failed to save settings for ${entryId}:`,+ result.error,+ );+ return res+ .status(500)+ .json({ success: false, error: result.error || 'Failed to save OAuth connection.' });}res.json({ success: true, data: finalDataToSave }); // Respond with the data that was saved-} catch (error) {console.error(`[PUT /oauth-connections] Error processing request for ${entryId}:`, error);- res.status(500).json({ success: false, error: 'An unexpected error occurred while saving the OAuth connection.' });+ res+ .status(500)+ .json({+ success: false,+ error: 'An unexpected error occurred while saving the OAuth connection.',+ });}});router.delete('/oauth-connections/:connectionId', includeTeamDetails, async (req, res) => {const { connectionId } = req.params;- if (!connectionId || typeof connectionId !== 'string' || !connectionId.startsWith('OAUTH_') || !connectionId.endsWith('_TOKENS')) {- return res.status(400).json({ success: false, error: 'Invalid or missing connectionId parameter.' });+ if (+ !connectionId ||+ typeof connectionId !== 'string' ||+ !connectionId.startsWith('OAUTH_') ||+ !connectionId.endsWith('_TOKENS')+ ) {+ return res+ .status(400)+ .json({ success: false, error: 'Invalid or missing connectionId parameter.' });}try {const result = await deleteTeamSettingsObj(req, OAUTH_SETTING_KEY, connectionId);if (!result.success) {- return res.status(500).json({ success: false, error: result.error || 'Failed to delete OAuth connection.' });+ return res+ .status(500)+ .json({ success: false, error: result.error || 'Failed to delete OAuth connection.' });}res.status(200).json({ success: true });} catch (error) {console.error(`Error deleting OAuth connection ${connectionId}:`, error);- res.status(500).json({ success: false, error: 'An unexpected error occurred while deleting the OAuth connection.' });+ res+ .status(500)+ .json({+ success: false,+ error: 'An unexpected error occurred while deleting the OAuth connection.',+ });}});@@ -548,12 +644,12 @@ const handleCustomLLMSave = async (req, res) => {// delete the custom LLM model cacheawait cacheClient.del(config.cache.getCustomModelsCacheKey(teamId)).catch((error) => {- console.warn('Error deleting custom LLM model cache:', error);+ console.warn('Error deleting custom LLM model cache:', error?.message);});res.status(200).json({ success: true, data: saveCustomLLM.data });} catch (error) {- console.error('Error saving custom LLM model:', error);+ console.error('Error saving custom LLM model:', error?.message);res.status(500).json({ success: false, error: 'Error saving custom LLM model.' });}};@@ -628,7 +724,7 @@ router.delete('/custom-llm/:provider/:id', customLLMRouteMiddlewares, async (req// delete the custom LLM model cacheawait cacheClient.del(config.cache.getCustomModelsCacheKey(teamId)).catch((error) => {- console.warn('Error deleting custom LLM model cache:', error);+ console.warn('Error deleting custom LLM model cache:', error?.message);});res.status(200).json({ success: true, data: deleteModel.data });diff --git a/packages/app/src/backend/routes/api/user-settings/router.ts b/packages/app/src/backend/routes/api/user-settings/router.tsindex 06de3ae3..3b1f6251 100644--- a/packages/app/src/backend/routes/api/user-settings/router.ts+++ b/packages/app/src/backend/routes/api/user-settings/router.ts@@ -1,6 +1,6 @@import express from 'express';-import * as userData from '../../../services/user-data.service';import { userSettingKeys } from '../../../../shared/userSettingKeys';+import * as userData from '../../../services/user-data.service';import { getUserCurrentTeamId, getUserSettingsByKey } from '../../../utils/api.utils';export const userSettingsRouter = express.Router();@@ -11,7 +11,7 @@ userSettingsRouter.get(`/${userSettingKeys.USER_TEAM}`, async (req, res) => {const { userSelectedTeam } = await getUserCurrentTeamId(token);res.json({ userSelectedTeam });} catch (error) {- console.error('Failed to fetch user team settings:', error);+ console.error('Failed to fetch user team settings:', error?.message);res.status(500).json({ error: 'Failed to fetch user team settings' });}});diff --git a/packages/app/src/backend/routes/oauth/router.ts b/packages/app/src/backend/routes/oauth/router.tsindex e8cd6aac..6fa8c1dd 100644--- a/packages/app/src/backend/routes/oauth/router.ts+++ b/packages/app/src/backend/routes/oauth/router.ts@@ -92,7 +92,7 @@ router.post('/checkAuth', includeTeamDetails, async (req, res) => {res.status(404).send('No existing OAuth settings found.');}} catch (error) {- console.error('Error during comparing oauth values:', error);+ console.error('Error during comparing oauth values:', error?.message);// Send a 500 Internal Server Error response with an error message.res.status(500).send('Failed to compare oauth values.');}@@ -158,7 +158,8 @@ router.post('/init', includeTeamDetails, oauthStrategyInitialization, async (reqif (requestTokenURL) oauthParams.requestTokenURL = encodeURIComponent(requestTokenURL);if (accessTokenURL) oauthParams.accessTokenURL = encodeURIComponent(accessTokenURL);- if (userAuthorizationURL) oauthParams.userAuthorizationURL = encodeURIComponent(userAuthorizationURL);+ if (userAuthorizationURL)+ oauthParams.userAuthorizationURL = encodeURIComponent(userAuthorizationURL);authUrl +='?' +@@ -172,7 +173,7 @@ router.post('/init', includeTeamDetails, oauthStrategyInitialization, async (req// console.log({ authUrl })res.json({ authUrl });} catch (error) {- console.error('Error in /init route:', error);+ console.error('Error in /init route:', error?.message);res.status(500).json({ error: 'Failed to initialize authentication' });}});@@ -241,7 +242,7 @@ router.get('/:provider', async (req, res, next) => {// For example, redirect or respond with a message})(req, res, next);} catch (error) {- console.error('Error during authentication process:', error);+ console.error('Error during authentication process:', error?.message);return res.status(500).send('Failed to initiate authentication.');}});@@ -272,8 +273,8 @@ function getCallbackOrigin(req: express.Request): string {}// For development, if running on localhost:4000 (backend), assume frontend is on 4002- const callbackUrl = req.session?.oauth_info?.oauth2CallbackURL ||- req.session?.oauth_info?.oauth1CallbackURL;+ const callbackUrl =+ req.session?.oauth_info?.oauth2CallbackURL || req.session?.oauth_info?.oauth1CallbackURL;if (callbackUrl && callbackUrl.includes('localhost:4000')) {return 'http://localhost:4002';@@ -350,7 +351,7 @@ router.get('/:provider/callback', async (req, res, next) => {await handleTokenStorage(req.session, user, req);handleSuccessfulAuthentication(req.session.strategyType, res);} catch (error) {- console.error('Error exchanging code for tokens:', error);+ console.error('Error exchanging code for tokens:', error?.message);const origin = getCallbackOrigin(req);res.send(`<script>@@ -400,7 +401,7 @@ router.get('/:provider/callback', async (req, res, next) => {await handleTokenStorage(req.session, user, req);handleSuccessfulAuthentication(req.session.strategyType, res);} catch (error) {- console.error('Error in callback route:', error);+ console.error('Error in callback route:', error?.message);const errorMessage = `${error.message || 'Unknown error'}.`;const origin = getCallbackOrigin(req);const errorScript = `@@ -478,12 +479,17 @@ async function handleTokenStorage(session, oauthUser, req) {const settingKey = 'oauth';await handleOAuthOperation(settingKey, entryId, tokensData, req);} catch (error) {- console.error('Error in handleTokenStorage:', error);+ console.error('Error in handleTokenStorage:', error?.message);throw error; // Re-throw the error for higher-level handling}}-async function handleOAuthOperation(settingKey: string, entryId: string, newDataFromAuthFlow: any, req: express.Request) {+async function handleOAuthOperation(+ settingKey: string,+ entryId: string,+ newDataFromAuthFlow: any,+ req: express.Request,+) {try {const existingSettings = await getTeamSettingsObj(req, settingKey);const existingEntryData = existingSettings?.[entryId] || {};@@ -514,16 +520,20 @@ async function handleOAuthOperation(settingKey: string, entryId: string, newData// Ensure oauth_info is merged correctly if it exists in bothif ((baseSettings as any).oauth_info && newSettingsFromAuthFlow.oauth_info) {- mergedSettings.oauth_info = { ...(baseSettings as any).oauth_info, ...newSettingsFromAuthFlow.oauth_info };+ mergedSettings.oauth_info = {+ ...(baseSettings as any).oauth_info,+ ...newSettingsFromAuthFlow.oauth_info,+ };}// Preserve existing display metadata if missing in incoming data- if ((baseSettings as any).name && !mergedSettings.name) mergedSettings.name = (baseSettings as any).name;- if ((baseSettings as any).platform && !mergedSettings.platform) mergedSettings.platform = (baseSettings as any).platform;+ if ((baseSettings as any).name && !mergedSettings.name)+ mergedSettings.name = (baseSettings as any).name;+ if ((baseSettings as any).platform && !mergedSettings.platform)+ mergedSettings.platform = (baseSettings as any).platform;// Ensure name key exists to classify as named (even if empty)if (typeof mergedSettings.name === 'undefined') mergedSettings.name = '';-// NormalizemergedSettings = normalizeAuthSettings(mergedSettings);@@ -574,7 +584,7 @@ function handleSuccessfulAuthentication(strategyType, res) {}, 500);</script>`);} catch (error) {- console.error('Error in handleSuccessfulAuthentication:', error);+ console.error('Error in handleSuccessfulAuthentication:', error?.message);throw error; // Re-throw the error for higher-level handling}}@@ -591,7 +601,7 @@ async function compareOAuthDetails(existing: Record<string, any>, req: express.Rtry {connectionData = typeof entryData === 'string' ? JSON.parse(entryData) : entryData;} catch (error) {- console.error('Error parsing target object:', error);+ console.error('Error parsing target object:', error?.message);return false;}@@ -628,7 +638,9 @@ router.post('/signOut', includeTeamDetails, async (req, res) => {const settings = await getTeamSettingsObj(req, 'oauth');if (!settings || !settings[entryId]) {- return res.status(404).json({ error: 'No existing OAuth settings found for the provided prefix.' });+ return res+ .status(404)+ .json({ error: 'No existing OAuth settings found for the provided prefix.' });}// Parse existing data if it's a string@@ -636,7 +648,7 @@ router.post('/signOut', includeTeamDetails, async (req, res) => {try {existingData = typeof existingData === 'string' ? JSON.parse(existingData) : existingData;} catch (error) {- console.error('Error parsing existing settings:', error);+ console.error('Error parsing existing settings:', error?.message);return res.status(500).json({ error: 'Invalid settings format' });}@@ -666,7 +678,6 @@ router.post('/signOut', includeTeamDetails, async (req, res) => {if (updatedData.auth_data.expires_in === undefined) {delete updatedData.auth_data.expires_in;}-} else {// Old structure: Clear tokens at the top levelupdatedData = {@@ -681,13 +692,16 @@ router.post('/signOut', includeTeamDetails, async (req, res) => {}// If tokens were already empty, respond without saving (optional optimization)- const currentPrimary = existingData.auth_data ? existingData.auth_data.primary : existingData.primary;- const currentSecondary = existingData.auth_data ? existingData.auth_data.secondary : existingData.secondary;+ const currentPrimary = existingData.auth_data+ ? existingData.auth_data.primary+ : existingData.primary;+ const currentSecondary = existingData.auth_data+ ? existingData.auth_data.secondary+ : existingData.secondary;if (currentPrimary === '' && currentSecondary === '') {return res.json({ invalidate: true, message: 'Already signed out.' });}-// Save the updated settingsconst saveResult = await saveTeamSettingsObj({req,@@ -703,13 +717,11 @@ router.post('/signOut', includeTeamDetails, async (req, res) => {return res.json({ invalidate: true, message: 'Signed out successfully.' });} catch (error) {- console.error('Error during sign out:', error);+ console.error('Error during sign out:', error?.message);return res.status(500).json({ error: 'Failed to process Sign out. ' + error.message });}});--async function getClientCredentialToken({ clientID, clientSecret, tokenURL }) {try {// Sanity checks@@ -762,7 +774,7 @@ router.post('/client_credentials', includeTeamDetails, async (req, res) => {res.json({ success: true, message: 'OAuth2 Authentication was successful' });} catch (error) {- console.error('Error in client_credentials route:', error);+ console.error('Error in client_credentials route:', error?.message);res.status(500).json({success: false,message: `OAuth2 Authentication was unsuccessful: ${error.message}`,diff --git a/packages/app/src/backend/routes/pages/router.ts b/packages/app/src/backend/routes/pages/router.tsindex 0e39961c..135cb0bb 100644--- a/packages/app/src/backend/routes/pages/router.ts+++ b/packages/app/src/backend/routes/pages/router.ts@@ -61,7 +61,7 @@ router.get('/', async (req, res) => {agents: agents || [],});} catch (error) {- console.error('Error fetching agents:', error);+ console.error('Error fetching agents:', error?.message);res.status(500).send('Error fetching agents');}});@@ -90,7 +90,7 @@ router.get('/builder/:agentId', llmModelsLoaderMiddleware, async (req, res) => {const { agent } = await userData.getAgent(req, agentId);agentData = { ...agent };} catch (error) {- console.error('Error fetching agent:', error);+ console.error('Error fetching agent:', error?.message);}res.render('index', {@@ -103,7 +103,7 @@ router.get('/builder/:agentId', llmModelsLoaderMiddleware, async (req, res) => {...res.locals.ejsOnboardingData,});} catch (error) {- console.error('Error fetching agent:', error);+ console.error('Error fetching agent:', error?.message);res.status(500).send('Error fetching agent');}});@@ -167,7 +167,7 @@ router.get(}}} catch (error) {- console.error('Error in /agents route:', error);+ console.error('Error in /agents route:', error?.message);return next(error);}return next();@@ -176,7 +176,7 @@ router.get(try {return createReactRoute()(req, res);} catch (error) {- console.error('Error in /agents route:', error);+ console.error('Error in /agents route:', error?.message);return next(error);}},diff --git a/packages/app/src/backend/routes/router.helpers/customLLM.helper.ts b/packages/app/src/backend/routes/router.helpers/customLLM.helper.tsindex 1cb0c557..37b9b4c0 100644--- a/packages/app/src/backend/routes/router.helpers/customLLM.helper.ts+++ b/packages/app/src/backend/routes/router.helpers/customLLM.helper.ts@@ -1,18 +1,18 @@-import Joi, { custom } from 'joi';+import Joi from 'joi';+import { Request } from 'express';import {- CUSTOM_LLM_PROVIDERS,BEDROCK_REGIONS,CUSTOM_LLM_FEATURES,+ CUSTOM_LLM_PROVIDERS,VERTEX_AI_REGIONS,} from '../../../shared/constants/custom-llm.constants';+import { customModels } from '../../../shared/custom-models';+import { CUSTOM_LLM_SETTINGS_KEY } from '../../constants';import { vault } from '../../services/SmythVault.class';-import { setVaultKeys } from '../router.helpers/vault.helper';import * as teamData from '../../services/team-data.service';-import { CUSTOM_LLM_SETTINGS_KEY } from '../../constants';-import { Request } from 'express';import { uid } from '../../services/utils.service';-import { customModels } from '../../../shared/custom-models';+import { setVaultKeys } from '../router.helpers/vault.helper';interface AuthInfo {accessToken: string;@@ -312,7 +312,7 @@ async function _saveBedrockModel(req: Request, params: BedrockModelInputParams)return { data: { id: entryId, name, provider } };} catch (error) {- console.error('Error saving Bedrock model:', error);+ console.error('Error saving Bedrock model:', error?.message);throw error;}}@@ -390,7 +390,7 @@ async function _saveVertexAIModel(req: Request, params: VertexAIModelInputParamsreturn { data: { id: entryId, name, provider } };} catch (error) {- console.error('Error saving VertexAI model:', error);+ console.error('Error saving VertexAI model:', error?.message);throw error;}}@@ -472,5 +472,5 @@ export const customLLMHelper = {deleteCustomLLM,getCustomLLMWithCredentials,getCustomLLMByName,- getCustomLLMByEntryId+ getCustomLLMByEntryId,};diff --git a/packages/app/src/backend/routes/router.helpers/vault.helper.ts b/packages/app/src/backend/routes/router.helpers/vault.helper.tsindex 9e55ef47..0688777e 100644--- a/packages/app/src/backend/routes/router.helpers/vault.helper.ts+++ b/packages/app/src/backend/routes/router.helpers/vault.helper.ts@@ -1,7 +1,7 @@-import Joi from 'joi';import { Request } from 'express';-import { vault } from '../../services/SmythVault.class';+import Joi from 'joi';import { type VaultKeyObj } from '../../../shared/types';+import { vault } from '../../services/SmythVault.class';// * Refined implementation of vault.utils.ts@@ -49,7 +49,7 @@ export const setVaultKeys = async ({const { error } = schemaToSet.validate(keyEntries);if (error) {- console.log('Error validating request: ', error);+ console.log('Error validating request: ', error?.message);return { success: false, error: 'Invalid request.' };}diff --git a/packages/app/src/backend/routes/router.utils/templates.utils.ts b/packages/app/src/backend/routes/router.utils/templates.utils.tsindex 5b7c403f..485332fa 100644--- a/packages/app/src/backend/routes/router.utils/templates.utils.ts+++ b/packages/app/src/backend/routes/router.utils/templates.utils.ts@@ -155,7 +155,7 @@ export async function getIntegrations() {return preparedIntegrations;} catch (error) {- console.log('error', error);+ console.log('error', error?.message);return [];}}diff --git a/packages/app/src/backend/routes/router.utils/vault.utils.ts b/packages/app/src/backend/routes/router.utils/vault.utils.tsindex 43fba78d..3530c174 100644--- a/packages/app/src/backend/routes/router.utils/vault.utils.ts+++ b/packages/app/src/backend/routes/router.utils/vault.utils.ts@@ -1,8 +1,8 @@-import Joi from 'joi';import { Request } from 'express';-import { vault } from '../../services/SmythVault.class';-import { type VaultKeyObj } from '../../../shared/types';+import Joi from 'joi';import { VAULT_SCOPE_AGENT_LLM } from '../../../shared/constants/general';+import { type VaultKeyObj } from '../../../shared/types';+import { vault } from '../../services/SmythVault.class';// TODO: Move all functions to vault.helpers.ts@@ -81,7 +81,7 @@ export async function getVaultKeys(req: Request) {const { error } = schemaToGet.validate({ ...args });if (error) {- console.log('Error validating request: ', error);+ console.log('Error validating request: ', error?.message);return {};}const allKeys = await vault.get(args, req);@@ -109,7 +109,7 @@ export const setVaultKey = async (req, keyId = '') => {const { error } = schemaToSet.validate({ key, keyName, scope });if (error) {- console.log('Error validating request: ', error);+ console.log('Error validating request: ', error?.message);return { success: false, error: 'Invalid request.' };}@@ -146,10 +146,8 @@ export const setVaultKey = async (req, keyId = '') => {return { success: true, data: { keyId: setKey?.data } };};-export const countVaultKeys = (- teamId: string,- req: Request,-): Promise<number> => vault.count(teamId, req);+export const countVaultKeys = (teamId: string, req: Request): Promise<number> =>+ vault.count(teamId, req);export type VaultSecret = {key: string;diff --git a/packages/app/src/backend/services/LLMHelper/LLMService.class.ts b/packages/app/src/backend/services/LLMHelper/LLMService.class.tsindex 579485ca..1b12d950 100644--- a/packages/app/src/backend/services/LLMHelper/LLMService.class.ts+++ b/packages/app/src/backend/services/LLMHelper/LLMService.class.ts@@ -43,7 +43,7 @@ export class LLMService {this.cacheModels(latestModels, config.cache.getCustomModelsCacheKey(teamId)).catch((error) => {- console.error('Error caching models', error);+ console.error('Error caching models', error?.message);},);@@ -65,7 +65,7 @@ export class LLMService {return result?.data || {};} catch (error) {- console.warn('Error getting fresh models', error);+ console.warn('Error getting fresh models', error?.message);return {};}}@@ -80,7 +80,7 @@ export class LLMService {});return result?.data || {};} catch (error) {- console.warn('Error getting fresh custom models', error);+ console.warn('Error getting fresh custom models', error?.message);return {};}}@@ -97,7 +97,7 @@ export class LLMService {if (latestModels && Object.keys(latestModels).length > 0) {this.cacheModels(latestModels, config.cache.STANDARD_MODELS_CACHE_KEY).catch((error) => {- console.error('Error caching models', error);+ console.error('Error caching models', error?.message);});}diff --git a/packages/app/src/backend/services/LLMHelper/index.ts b/packages/app/src/backend/services/LLMHelper/index.tsindex 2b2f839c..e5bcd08f 100644--- a/packages/app/src/backend/services/LLMHelper/index.ts+++ b/packages/app/src/backend/services/LLMHelper/index.ts@@ -80,7 +80,7 @@ async function getUserLLMModels(req: Request) {models[modelId] = modelTpl;}} catch (error) {- console.error('Error getting User LLMs', error);+ console.error('Error getting User LLMs', error?.message);}return models;diff --git a/packages/app/src/backend/services/SmythFS.class.ts b/packages/app/src/backend/services/SmythFS.class.tsindex 2d0945d5..74e70862 100644--- a/packages/app/src/backend/services/SmythFS.class.ts+++ b/packages/app/src/backend/services/SmythFS.class.ts@@ -25,7 +25,7 @@ class SmythFS {await mkdir(dir, { recursive: true });}} catch (error) {- console.log('[SmythFS] Error ensuring directory: \nError: ', error);+ console.log('[SmythFS] Error ensuring directory: \nError: ', error?.message);}}@@ -86,7 +86,7 @@ class SmythFS {const content = await this.read(path);return content ? JSON.parse(content) : null;} catch (error) {- console.log('Error reading cache file \nPath:', path, '\nError:', error);+ console.log('Error reading cache file \nPath:', path, '\nError:', error?.message);return null;}}@@ -95,7 +95,7 @@ class SmythFS {try {await this.writeFile(path, JSON.stringify(content));} catch (error) {- console.log('Error writing cache file \nPath:', path, '\nError:', error);+ console.log('Error writing cache file \nPath:', path, '\nError:', error?.message);}}diff --git a/packages/app/src/backend/services/hubspot.service.ts b/packages/app/src/backend/services/hubspot.service.tsindex 1b9be9cc..2920ae92 100644--- a/packages/app/src/backend/services/hubspot.service.ts+++ b/packages/app/src/backend/services/hubspot.service.ts@@ -12,32 +12,32 @@ interface HubspotField {export async function submitFeedbackForm(feedbackData: FeedbackData, userEmail: string) {const formID = '5400499e-4ae8-433a-b0bf-6e5e5c1c261c';-+try {const response = await fetch(`https://api.hsforms.com/submissions/v3/integration/submit/${HUBSPOT_PORTAL_ID}/${formID}`,{method: 'POST',headers: {- 'Content-Type': 'application/json'+ 'Content-Type': 'application/json',},body: JSON.stringify({fields: [{name: 'feedback_text',- value: feedbackData?.text || ''+ value: feedbackData?.text || '',},{name: 'feedback_emoji',- value: feedbackData?.emoji || 'none'+ value: feedbackData?.emoji || 'none',},{name: 'email',- value: userEmail- }- ]- })- }+ value: userEmail,+ },+ ],+ }),+ },);if (!response?.ok) {@@ -49,7 +49,7 @@ export async function submitFeedbackForm(feedbackData: FeedbackData, userEmail:const result = await response.json();return result;} catch (error) {- console.error('Error submitting to HubSpot:', error);+ console.error('Error submitting to HubSpot:', error?.message);return null;}-}\ No newline at end of file+}diff --git a/packages/app/src/backend/services/logto-helper.ts b/packages/app/src/backend/services/logto-helper.tsindex 6c60b3cf..7f7492cc 100644--- a/packages/app/src/backend/services/logto-helper.ts+++ b/packages/app/src/backend/services/logto-helper.ts@@ -42,7 +42,7 @@ export function getM2MToken(resource?, scope?): Promise<string> {resolve(tokenData.access_token);}).catch((error) => {- reject({ error: error.response.data });+ reject({ error: error?.response?.data });});});}diff --git a/packages/app/src/backend/services/storage/LocalStorage.class.ts b/packages/app/src/backend/services/storage/LocalStorage.class.tsindex f4651158..659c66dd 100644--- a/packages/app/src/backend/services/storage/LocalStorage.class.ts+++ b/packages/app/src/backend/services/storage/LocalStorage.class.ts@@ -51,7 +51,7 @@ export default class LocalStorage implements StaticStorage {logger.info('Storage directories created successfully');} catch (error) {- logger.error('Failed to create storage directories:', error);+ logger.error('Failed to create storage directories:', error?.message);throw error;}}@@ -65,7 +65,7 @@ export default class LocalStorage implements StaticStorage {await fsPromises.mkdir(this.publicPath, { recursive: true });await fsPromises.mkdir(this.privatePath, { recursive: true });} catch (error) {- logger.error('Failed to create storage directories:', error);+ logger.error('Failed to create storage directories:', error?.message);throw error;}}diff --git a/packages/app/src/backend/services/team-data.service.ts b/packages/app/src/backend/services/team-data.service.tsindex 3f1ea2f6..d8ead9c2 100644--- a/packages/app/src/backend/services/team-data.service.ts+++ b/packages/app/src/backend/services/team-data.service.ts@@ -238,7 +238,7 @@ export async function getAllTeamsSecrets(skip: number, limit: number, token: strreturn res?.data?.settings || [];} catch (error) {- // console.log('Error in getAllTeamsSecrets', error);+ // console.log('Error in getAllTeamsSecrets', error?.message);return null;}}diff --git a/packages/app/src/backend/utils/acls.utils.ts b/packages/app/src/backend/utils/acls.utils.tsindex 8a857e86..79437def 100644--- a/packages/app/src/backend/utils/acls.utils.ts+++ b/packages/app/src/backend/utils/acls.utils.ts@@ -1,10 +1,8 @@import Joi from 'joi';+import { cloneDeep } from 'lodash-es';import { AclRule, CombinedAclRules, DefaultRole } from '../../shared/constants/acl.constant';import config from '../config';-import { cloneDeep } from 'lodash-es';-import templateAcls from '../../shared/constants/acl.constant.json';-export { isDefaultRole } from './default.acls';-export { getDefaultRoleAcls } from './default.acls';+export { getDefaultRoleAcls, isDefaultRole } from './default.acls';type Rules = {[key: string]: AclRule;@@ -157,7 +155,7 @@ export function getObjValue(obj: { [key: string]: any }, key: string): any {}}} catch (error) {- console.error('Error creating regex from path:', error);+ console.error('Error creating regex from path:', error?.message);// Fallback to simple prefix matching if regex failsfor (const objKey in obj) {if (objKey.startsWith(key)) {diff --git a/packages/app/src/backend/utils/api.utils.ts b/packages/app/src/backend/utils/api.utils.tsindex 10e040d0..1f604f5b 100644--- a/packages/app/src/backend/utils/api.utils.ts+++ b/packages/app/src/backend/utils/api.utils.ts@@ -88,7 +88,7 @@ export const getUserCurrentTeamId = async (userSelectedTeam: userSelectedTeam || userTeam?.id || null,};} catch (error) {- console.error('Error fetching user current team ID:', error);+ // console.error('Error fetching user current team ID:', error?.message);// throw new Error('Failed to fetch user current team ID');return emptyResponse;}