Skip to content

Commit b290bc0

Browse files
committed
Add debug info
1 parent 690901c commit b290bc0

4 files changed

Lines changed: 789 additions & 0 deletions

File tree

MyApp/debug-env.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bun
2+
3+
console.log('=== Environment Debug Info ===')
4+
console.log('Bun version:', Bun.version)
5+
console.log('Platform:', process.platform)
6+
console.log('Architecture:', process.arch)
7+
console.log('Node version:', process.version)
8+
console.log('Working directory:', process.cwd())
9+
10+
console.log('\n=== File System Check ===')
11+
const files = [
12+
'wwwroot/test/object_info.json',
13+
'wwwroot/test/JibMixRealisticv18.v1.json',
14+
'src/to-api-prompt.ts'
15+
]
16+
17+
for (const file of files) {
18+
const bunFile = Bun.file(file)
19+
console.log(`${file}: ${await bunFile.exists() ? 'EXISTS' : 'MISSING'}`)
20+
if (await bunFile.exists()) {
21+
const stat = await bunFile.stat()
22+
console.log(` Size: ${stat.size} bytes`)
23+
console.log(` Modified: ${stat.mtime}`)
24+
}
25+
}
26+
27+
console.log('\n=== Package Dependencies ===')
28+
try {
29+
const packageJson = await Bun.file('package.json').json()
30+
console.log('Dependencies:', packageJson.devDependencies)
31+
} catch (e) {
32+
console.log('Error reading package.json:', e.message)
33+
}
34+
35+
console.log('\n=== LiteGraph Import Test ===')
36+
try {
37+
const { LGraph, LGraphNode, LiteGraph } = await import('@comfyorg/litegraph')
38+
console.log('LiteGraph imported successfully')
39+
console.log('LGraph constructor:', typeof LGraph)
40+
console.log('LGraphNode constructor:', typeof LGraphNode)
41+
console.log('LiteGraph object:', typeof LiteGraph)
42+
43+
// Test basic LGraph creation
44+
const graph = new LGraph()
45+
console.log('LGraph instance created:', !!graph)
46+
console.log('LGraph methods:', Object.getOwnPropertyNames(Object.getPrototypeOf(graph)).filter(name => typeof graph[name] === 'function').slice(0, 10))
47+
48+
} catch (e) {
49+
console.log('Error importing LiteGraph:', e.message)
50+
console.log('Stack:', e.stack)
51+
}
52+
53+
console.log('\n=== Global Environment ===')
54+
console.log('globalThis keys:', Object.keys(globalThis).filter(k => k.includes('COMFY') || k.includes('litegraph')))
55+
56+
// Test the specific error scenario
57+
console.log('\n=== Testing Graph Creation ===')
58+
try {
59+
const { LGraph } = await import('@comfyorg/litegraph')
60+
const graph = new LGraph()
61+
62+
// Check if the graph has the problematic property
63+
console.log('Graph properties:', Object.getOwnPropertyNames(graph).filter(name => name.includes('node') || name.includes('execution')))
64+
65+
// Try to call computeExecutionOrder which might trigger the error
66+
console.log('Testing computeExecutionOrder...')
67+
const executionOrder = graph.computeExecutionOrder(false)
68+
console.log('computeExecutionOrder succeeded, returned:', Array.isArray(executionOrder) ? `Array(${executionOrder.length})` : typeof executionOrder)
69+
70+
} catch (e) {
71+
console.log('Error in graph creation test:', e.message)
72+
console.log('Stack:', e.stack)
73+
}

MyApp/minimal-repro.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bun
2+
3+
// Minimal reproduction of the issue
4+
import { LGraph, LGraphNode, LiteGraph } from '@comfyorg/litegraph'
5+
6+
console.log('Starting minimal reproduction...')
7+
8+
try {
9+
// Mock the global frontend version variable (from original script)
10+
;(globalThis as any).__COMFYUI_FRONTEND_VERSION__ = '1.0.0-test'
11+
12+
console.log('Creating LGraph instance...')
13+
const graph = new LGraph()
14+
15+
console.log('Graph created successfully')
16+
console.log('Graph instance:', !!graph)
17+
18+
// Test the specific method that might be causing issues
19+
console.log('Testing computeExecutionOrder...')
20+
const executionOrder = graph.computeExecutionOrder(false)
21+
console.log('computeExecutionOrder completed successfully')
22+
23+
// Test creating a simple node
24+
console.log('Testing node creation...')
25+
26+
// Create a mock node class
27+
class TestNode extends LGraphNode {
28+
static title = "TestNode"
29+
static comfyClass = "TestNode"
30+
comfyClass: string
31+
32+
constructor() {
33+
super("TestNode")
34+
this.comfyClass = "TestNode"
35+
this.title = "TestNode"
36+
}
37+
}
38+
39+
// Register the node type
40+
LiteGraph.registerNodeType("TestNode", TestNode)
41+
42+
// Create a node
43+
const node = LiteGraph.createNode("TestNode")
44+
if (node) {
45+
console.log('Node created successfully')
46+
graph.add(node)
47+
console.log('Node added to graph')
48+
49+
// Test execution order again with a node
50+
const executionOrder2 = graph.computeExecutionOrder(false)
51+
console.log('computeExecutionOrder with node completed successfully')
52+
} else {
53+
console.log('Failed to create node')
54+
}
55+
56+
// Test serialization
57+
console.log('Testing graph serialization...')
58+
const serialized = graph.serialize({ sortNodes: false })
59+
console.log('Graph serialized successfully')
60+
61+
console.log('All tests passed!')
62+
63+
} catch (error) {
64+
console.error('Error occurred:', error.message)
65+
console.error('Stack trace:', error.stack)
66+
67+
// Additional debugging
68+
console.log('\n=== Additional Debug Info ===')
69+
console.log('Error name:', error.name)
70+
console.log('Error constructor:', error.constructor.name)
71+
72+
// Check if it's the specific error we're looking for
73+
if (error.message.includes('nodesByExecutionId')) {
74+
console.log('This is the nodesByExecutionId error!')
75+
console.log('Likely cause: LiteGraph library initialization issue')
76+
}
77+
}

MyApp/src/to-api-prompt.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
import { LGraph, LGraphNode, LiteGraph } from '@comfyorg/litegraph'
44

5+
// Ensure proper initialization
6+
if (typeof globalThis !== 'undefined') {
7+
;(globalThis as any).__COMFYUI_FRONTEND_VERSION__ = '1.0.0-test'
8+
}
9+
510
import {
611
ComfyWorkflowJSON,
712
validateComfyWorkflow

0 commit comments

Comments
 (0)