Running Gatling JS Version

Gatling version: 10.2.3
Gatling flavor: javascript/typescript
Gatling build tool: npm/vs code/windows

I’m trying to execute a Gatling Simulation using JS and VS Code, the problem is…I keep getting the attached error. Anyone got any suggestions? I know enough JS to be dangerous but not enough to diagnose what the hell this is.

Anyone with either enough JS or Gatling experience who can point me in the right direction would be a god send.

It’s not like I’m trying to do anything clever, just run the just run the sample scripts from their own repo: GitHub - gatling/gatling-js-demo: Showcase of the Gatling JavaScript and TypeScript DSL.

PS C:\Gattling\gatling-js-demo\typescript> npx gatling run --simulation basicSimulation
Bundling a Gatling simulation with options:

  • sourcesFolder: src
  • bundleFile: target/bundle.js
  • typescript: true
    Running a Gatling simulation with options:
  • simulation: basicSimulation
  • bundleFile: target/bundle.js
  • resourcesFolder: resources
  • resultsFolder: target/gatling
    11:52:33.108 [ERROR] i.g.a.Gatling$ - Run crashed
    org.graalvm.polyglot.PolyglotException: TypeError: Cannot load module: ‘buffer’: Illegal char <:> at index 2: /C:/Gattling/gatling-js-demo/typescript/target/bundle.js
    at .node_modules/@gatling.io/cli/polyfills/globals.js(bundle.js:46)
    at .__init(bundle.js:15)
    at .:=>(bundle.js:2975)
    at .:program(bundle.js:1)
    at org.graalvm.polyglot.Context.eval(Context.java:416)
    at io.gatling.js.JsSimulationHelper.loadSimulation(JsSimulationHelper.java:60)
    at io.gatling.js.JsSimulation.(JsSimulation.java:40)
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
    … 9 common frames omitted
    Wrapped by: java.lang.reflect.InvocationTargetException: null
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
    at io.gatling.app.SimulationClass$JavaScript.params(SimulationClass.scala:57)
    at io.gatling.app.Runner.load(Runner.scala:72)
    at io.gatling.app.Runner.run(Runner.scala:55)
    at io.gatling.app.Gatling$.start(Gatling.scala:83)
    at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
    at io.gatling.app.Gatling$.main(Gatling.scala:40)
    at io.gatling.app.Gatling.main(Gatling.scala)
    Exception in thread “main” java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
    at io.gatling.app.SimulationClass$JavaScript.params(SimulationClass.scala:57)
    at io.gatling.app.Runner.load(Runner.scala:72)
    at io.gatling.app.Runner.run(Runner.scala:55)
    at io.gatling.app.Gatling$.start(Gatling.scala:83)
    at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
    at io.gatling.app.Gatling$.main(Gatling.scala:40)
    at io.gatling.app.Gatling.main(Gatling.scala)
    Caused by: org.graalvm.polyglot.PolyglotException: TypeError: Cannot load module: ‘buffer’: Illegal char <:> at index 2: /C:/Gattling/gatling-js-demo/typescript/target/bundle.js
    at .node_modules/@gatling.io/cli/polyfills/globals.js(bundle.js:46)
    at .__init(bundle.js:15)
    at .:=>(bundle.js:2975)
    at .:program(bundle.js:1)
    at org.graalvm.polyglot.Context.eval(Context.java:416)
    at io.gatling.js.JsSimulationHelper.loadSimulation(JsSimulationHelper.java:60)
    at io.gatling.js.JsSimulation.(JsSimulation.java:40)
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
    … 9 more
    C:\Gattling\gatling-js-demo\typescript\node_modules@gatling.io\cli\target\java.js:35
    reject(Error("Gatling process finished with code " + code));
    ^

Error: Gatling process finished with code 1
at ChildProcess. (C:\Gattling\gatling-js-demo\typescript\node_modules@gatling.io\cli\target\java.js:35:24)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Node.js v20.10.0

I can reproduce the issue on Windows, currently investigating.

Thanks for the assist.

We think we have found the issue and will be releasing a fix as soon as possible.

1 Like

Gatling JS 3.14.101 has been released with a fix and the demo projects were updated consequently. You can either pull the changes or update the dependencies yourself and test again!