Skip to content

[Bug]: Graph input with a field of the type "object" is not working #489

@valerypopoff

Description

@valerypopoff

What happened?

Even with the minimal graph like this:
Image

And the code like this:

    let result = await runGraph(project, {
    //graph: '_main',
    inputs: {
      obj: {}
    },
    context: {
    },
    externalFunctions: {
    },  
    onUserEvent: {
    },
    openAiKey: process.env.openAiKey,
    openAiOrganization: '',
  })

I get this error:

Error running Rivet
Error: Graph 123 (VlYPTYilgVb_er3-AxeeQ) failed to process due to errors in nodes: Graph Input (KzXcn4Lx88xhuHDOkxxHu): TypeError: Cannot read properties of undefined (reading 'startsWith')
    at _GraphProcessor.processGraph (D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:13529:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Object.run (D:\Programming\Rivet\node_modules\@ironclad\rivet-node\dist\cjs\bundle.cjs:147:23)
    at async runRivet (D:\Programming\Rivet\src\index.js:7:16)

P.S.: When I try to pass an object with "context" instead of "inputs", I get a similar error:

D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:471
  return type.endsWith("[]");
              ^

TypeError: Cannot read properties of undefined (reading 'endsWith')
    at isArrayDataType (D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:471:15)
    at getScalarTypeOf (D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:492:7)
    at D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:14139:31
    at Array.filter (<anonymous>)
    at #excludedDueToControlFlow (D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:14138:56)
    at #processNodeIfAllInputsAvailable (D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:13654:39)
    at D:\Programming\Rivet\node_modules\@ironclad\rivet-core\dist\cjs\bundle.cjs:13774:52
    at run (D:\Programming\Rivet\node_modules\p-queue-6\dist\index.js:157:104)
    at PQueue._tryToStartAnother (D:\Programming\Rivet\node_modules\p-queue-6\dist\index.js:105:17)
    at D:\Programming\Rivet\node_modules\p-queue-6\dist\index.js:171:18

P.P.S:
If I pass an object like this:

  let result = await runGraph(project, {
    //graph: '_main',
    inputs: {
      obj: { type: 'object', value: {} }
    },
    context: {
    },
    externalFunctions: {
    },  
    onUserEvent: {
    },
    openAiKey: process.env.openAiKey,
    openAiOrganization: '',
  })

it works.

What was the expected functionality?

The graph runs

Describe your environment

Node v22.11.0
@ironclad/rivet-node": "1.23.1"

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions