WindmillWWindmill
Powered by
Stefan-neoS
Windmill•2y 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)
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)
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 {}
WindmillJoin
3,362Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

GraphQL Documentation in Windmill
biggedy.Bbiggedy. / help
3y ago
Cannot run any script Python / TS
KirellKKirell / help
17mo ago
How can I run a PowerShell script inside Windmill?
Trevor SullivanTTrevor Sullivan / help
3y ago
Trying to understand Windmill+Powershell
bohitiBbohiti / help
13mo ago