Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ class Confluence_MCP implements INode {
async getTools(nodeData: INodeData, options: ICommonObject): Promise<Tool[]> {
console.log('[CONFLUENCE MCP DEBUG] ========== getTools START ==========')
console.log('[CONFLUENCE MCP DEBUG] Timestamp:', new Date().toISOString())
console.log('[CONFLUENCE MCP DEBUG] nodeData.credential ID:', nodeData.credential)
console.log('[CONFLUENCE MCP DEBUG] options keys:', Object.keys(options || {}).join(', '))
console.log('[CONFLUENCE MCP DEBUG] nodeData.credential ID:', nodeData?.credential || 'NONE')
try {
console.log('[CONFLUENCE MCP DEBUG] options keys:', Object.keys(options || {}).join(', '))
} catch (e) {
console.log('[CONFLUENCE MCP DEBUG] options keys: ERROR -', String(e))
}

console.time('[CONFLUENCE MCP DEBUG] getCredentialData')
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
Expand Down
8 changes: 6 additions & 2 deletions packages/components/nodes/tools/MCP/Jira/JiraMCP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ class Jira_MCP implements INode {
async getTools(nodeData: INodeData, options: ICommonObject): Promise<Tool[]> {
console.log('[JIRA MCP DEBUG] ========== getTools START ==========')
console.log('[JIRA MCP DEBUG] Timestamp:', new Date().toISOString())
console.log('[JIRA MCP DEBUG] nodeData.credential ID:', nodeData.credential)
console.log('[JIRA MCP DEBUG] options keys:', Object.keys(options || {}).join(', '))
console.log('[JIRA MCP DEBUG] nodeData.credential ID:', nodeData?.credential || 'NONE')
try {
console.log('[JIRA MCP DEBUG] options keys:', Object.keys(options || {}).join(', '))
} catch (e) {
console.log('[JIRA MCP DEBUG] options keys: ERROR -', String(e))
}

console.time('[JIRA MCP DEBUG] getCredentialData')
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ export const getCredentialData = async (selectedCredentialId: string, options: I
return {}
}

console.log('[getCredentialData DEBUG] Credential found, name:', credential.name)
console.log('[getCredentialData DEBUG] Credential workspaceId:', credential.workspaceId)
console.log('[getCredentialData DEBUG] Credential found, name:', credential?.name || 'N/A')
console.log('[getCredentialData DEBUG] Credential workspaceId:', credential?.workspaceId || 'N/A')

// Decrypt credentialData
console.time('[getCredentialData DEBUG] Decrypt credential')
Expand Down
43 changes: 33 additions & 10 deletions packages/server/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,12 @@ export const buildFlow = async ({
if (!reactFlowNode || reactFlowNode === undefined || nodeIndex < 0) continue

try {
const nodeInstanceFilePath = componentNodes[reactFlowNode.data.name].filePath as string
const componentNode = componentNodes[reactFlowNode.data.name]
if (!componentNode) {
logger.error(`[buildFlow] Component node not found in pool: ${reactFlowNode.data.name} (id: ${reactFlowNode.id})`)
continue
}
const nodeInstanceFilePath = componentNode.filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const newNodeInstance = new nodeModule.nodeClass()

Expand Down Expand Up @@ -646,11 +651,15 @@ export const buildFlow = async ({
) {
initializedNodes.add(nodeId)
} else {
console.log(`[NODE INIT DEBUG] ========== Starting node initialization ==========`)
console.log(`[NODE INIT DEBUG] Node: ${reactFlowNode.data.label} (${reactFlowNode.data.name})`)
console.log(`[NODE INIT DEBUG] Node ID: ${reactFlowNode.data.id}`)
console.log(`[NODE INIT DEBUG] Has credential: ${!!reactFlowNode.data.credential}`)
console.log(`[NODE INIT DEBUG] Timestamp: ${new Date().toISOString()}`)
try {
console.log(`[NODE INIT DEBUG] ========== Starting node initialization ==========`)
console.log(`[NODE INIT DEBUG] Node: ${reactFlowNode?.data?.label || 'UNKNOWN'} (${reactFlowNode?.data?.name || 'UNKNOWN'})`)
console.log(`[NODE INIT DEBUG] Node ID: ${reactFlowNode?.data?.id || 'UNKNOWN'}`)
console.log(`[NODE INIT DEBUG] Has credential: ${!!reactFlowNode?.data?.credential}`)
console.log(`[NODE INIT DEBUG] Timestamp: ${new Date().toISOString()}`)
} catch (e) {
console.log('[NODE INIT DEBUG] Error logging node info:', String(e))
}

// Check and refresh credentials before node initialization if needed
console.time(`[NODE INIT DEBUG] checkAndRefreshCredentialsBeforeInit`)
Expand Down Expand Up @@ -820,7 +829,12 @@ export const clearSessionMemory = async (
// Only clear specific session memory from View Message Dialog UI
if (isClearFromViewMessageDialog && memoryType && node.data.label !== memoryType) continue

const nodeInstanceFilePath = componentNodes[node.data.name].filePath as string
const componentNode = componentNodes[node.data.name]
if (!componentNode) {
logger.warn(`[clearSessionMemory] Component node not found: ${node.data.name}`)
continue
}
const nodeInstanceFilePath = componentNode.filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const newNodeInstance = new nodeModule.nodeClass()
const options: ICommonObject = {
Expand Down Expand Up @@ -1827,7 +1841,12 @@ export const getSessionChatHistory = async (
logger: any,
prependMessages?: IMessage[]
): Promise<IMessage[]> => {
const nodeInstanceFilePath = componentNodes[memoryNode.data.name].filePath as string
const componentNode = componentNodes[memoryNode.data.name]
if (!componentNode) {
logger.error(`[getSessionChatHistory] Component node not found: ${memoryNode.data.name}`)
return []
}
const nodeInstanceFilePath = componentNode.filePath as string
const nodeModule = await import(nodeInstanceFilePath)
const newNodeInstance = new nodeModule.nodeClass()

Expand Down Expand Up @@ -2122,8 +2141,12 @@ export const needsCredentialRefresh = async (credentialId: string, options: { ap
* This ensures tokens are fresh before the node tries to use them
*/
export const checkAndRefreshCredentialsBeforeInit = async (reactFlowNode: IReactFlowNode, options: ICommonObject): Promise<void> => {
console.log('[checkAndRefreshCredentialsBeforeInit DEBUG] Called for node:', reactFlowNode.data.name, reactFlowNode.data.id)
console.log('[checkAndRefreshCredentialsBeforeInit DEBUG] Timestamp:', new Date().toISOString())
try {
console.log('[checkAndRefreshCredentialsBeforeInit DEBUG] Called for node:', reactFlowNode?.data?.name || 'UNKNOWN', reactFlowNode?.data?.id || 'UNKNOWN')
console.log('[checkAndRefreshCredentialsBeforeInit DEBUG] Timestamp:', new Date().toISOString())
} catch (e) {
console.log('[checkAndRefreshCredentialsBeforeInit DEBUG] Error logging:', String(e))
}

try {
// Check if this node requires OAuth refresh and has credentials
Expand Down