Stefan-neoS
Windmill2y ago
11 replies
Stefan-neo

Trying to run GraphQL script with windmill TS client throws error

Hi there, trying to run a windmill GraphQL script from another TS script via the windmill TS client but I'm encountering an issue. There's not much documentation on the TS client side so I'm unsure what the issue may be.

Given my GraphQL script has the following params: api: Object (the one that is always created for GraphQL scripts), title: string, issueId: string, url: string,

I am receiving the following issue when trying to call it via path from my TS script:

const graphQLResource = await wmill.getResource("f/resources/myResource")
await wmill.runScript("f/testDir/testAction", undefined, {
    api: graphQLResource,
    title: "Test Title",
    issueId: "Test",
    url: "https://www.google.com/"
  }, true)


Error:
SyntaxError: Failed to parse JSON
    at <parse> (:0)
    at json (native)
    at <anonymous> (/tmp/bun/node_modules/windmill-client/dist/client.js:238:5)


Edit:
Same error when the args parameter is using [] instead of {}
Was this page helpful?