Skip to content
Open
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
19 changes: 17 additions & 2 deletions packages/server/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,12 @@ export const buildFlow = async ({
const nodeModule = await import(nodeInstanceFilePath)
const newNodeInstance = new nodeModule.nodeClass()

let flowNodeData = cloneDeep(reactFlowNode.data)
// Don't deep-clone a node's already-built live `instance` (re-evaluated in loops):
// cloneDeep copies the prototype but bypasses the constructor, breaking ES private-member
// brand checks (e.g. openai v6 OpenAI.buildURL). Exclude it from the clone, re-attach the original.
const { instance, ...rest } = reactFlowNode.data
let flowNodeData = cloneDeep(rest) as INodeData
if (instance !== undefined) flowNodeData.instance = instance
Comment thread
dkindlund marked this conversation as resolved.

// Only override the config if its status is true
if (overrideConfig && apiOverrideStatus) {
Expand Down Expand Up @@ -1034,7 +1039,17 @@ export const resolveVariables = async (
availableVariables: IVariable[] = [],
variableOverrides: ICommonObject[] = []
): Promise<INodeData> => {
let flowNodeData = cloneDeep(reactFlowNodeData)
if (!reactFlowNodeData) {
return reactFlowNodeData
}

// Do not deep-clone a node's already-built live `instance` (e.g. an OpenAI SDK client, a gRPC
// channel, or a FAISS store). cloneDeep copies the prototype but bypasses the constructor, so the
// clone is missing from openai v6's private-member brand WeakSet and throws in OpenAI.buildURL:
// "Cannot read private member from an object whose class did not declare it". Exclude + re-attach.
const { instance, ...rest } = reactFlowNodeData
let flowNodeData = cloneDeep(rest) as INodeData
if (instance !== undefined) flowNodeData.instance = instance
Comment thread
dkindlund marked this conversation as resolved.

const getParamValues = async (paramsObj: ICommonObject) => {
for (const key in paramsObj) {
Expand Down
Loading