getgauge/gauge-ts

Gauge-ts 0.3.1 Update Causes Runtime Error: Invalid Memory Address or Nil Pointer Dereference

Closed this issue · 4 comments

Describe the bug

After updating gauge-ts from version 0.1.1 to 0.3.1, my project has started encountering a runtime error. The error message indicates an invalid memory address or nil pointer dereference. The update occurred when running npm install, which updated the Node modules and included the new version of gauge-ts (0.3.1).

To Reproduce
Steps to reproduce the behavior:

  1. Update gauge-ts to version 0.3.1 by running npm install.
  2. Run the project using the following environment setup:
    • OS: Windows, Mac
    • Node.js: 20.x
  3. Observe the runtime error.

Expected behavior

The project should run without encountering a runtime error after updating gauge-ts to version 0.3.1.

Desktop (please complete the following information):

  • OS: [Windows, Mac]
  • Gauge and plugin version
Gauge version: 1.6.7
html-report (4.3.0)
screenshot (0.2.0)
ts (0.3.1)
  • Node version [v20.11.0]
  • Npm version [10.4.0]

Additional context

import { start } from 'gauge-ts/dist/RunnerServer';
^^^^^^
SyntaxError: Cannot use import statement outside a module
    at new Script (node:vm:116:7)
    at runInContext (/path/to/node_modules/ts-node/src/repl.ts:670:18)
    at Object.execCommand (/path/to/node_modules/ts-node/src/repl.ts:639:28)
    at /path/to/node_modules/ts-node/src/repl.ts:661:47
    at Array.reduce (<anonymous>)
    at appendCompileAndEvalInput (/path/to/node_modules/ts-node/src/repl.ts:661:23)
    at Object.evalCode (/path/to/node_modules/ts-node/src/repl.ts:205:20)
    at evalAndExitOnTsError (/path/to/node_modules/ts-node/src/bin.ts:780:26)
    at phase4 (/path/to/node_modules/ts-node/src/bin.ts:656:7)
    at bootstrap (/path/to/node_modules/ts-node/src/bin.ts:95:10)
Updates are available. Run `gauge update -c` for more info.
Error ----------------------------------

[Gauge]
Error: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
runtime/debug.Stack()
    /opt/hostedtoolcache/go/1.22.2/x64/src/runtime/debug/stack.go:24 +0x5e
main.recoverPanic()
    /path/to/gauge/gauge.go:27 +0x34
panic({0xb4df20?, 0x1247080?})
    /opt/hostedtoolcache/go/1.22.2/x64/src/runtime/panic.go:770 +0x132
github.com/getgauge/gauge/runner.(*GrpcRunner).ExecuteMessageWithTimeout(0xc00059e182?, 0xc00023ef80?)
    /path/to/gauge/runner/grpcRunner.go:197 +0xe
github.com/getgauge/gauge/validation.(*SpecValidator).validateStep(0xc00062a040, 0xc0003e6300)
    /path/to/gauge/validation/validate.go:345 +0x1a2
github.com/getgauge/gauge/validation.(*SpecValidator).Step(0xc00062a040, 0xc0003e6300)
    /path/to/gauge/validation/validate.go:313 +0x3d9
github.com/getgauge/gauge/validation.(*SpecValidator).Step(0xc00062a040, 0xc00016c0c0?)
    /path/to/gauge/validation/validate.go:307 +0x525
github.com/getgauge/gauge/gauge.(*Specification).Traverse(0xc00016c0c0, {0xd67900, 0xc00062a040}, 0xc0001e38b0)
    /path/to/gauge/gauge/specification.go:261 +0x22f
github.com/getgauge/gauge/validation.(*SpecValidator).validate(0xc00062a040)
    /path/to/gauge/validation/validate.go:298 +0x55
github.com/getgauge/gauge/validation.(*validator).Validate(0xc0002cb9f0)
    /path/to/gauge/validation/validate.go:284 +0x10a
github.com/getgauge/gauge/validation.ValidateSpecs({0xc0001f37a0, 0x1, 0x1}, 0x0)
    /path/to/gauge/validation/validate.go:174 +0x238
github.com/getgauge/gauge/execution.init.func1({0xc0001f37a0, 0x1, 0x1})
    /path/to/gauge/execution/execute.go:108 +0x1c5
github.com/getgauge/gauge/cmd.execute(0x125cdc0, {0x12cd120, 0x0, 0x0})
    /path/to/gauge/cmd/run.go:241 +0x368
github.com/getgauge/gauge/cmd.init.func12(0x125cdc0, {0x12cd120, 0x0, 0x0})
    /path/to/gauge/cmd/run.go:90 +0x1b9
github.com/spf13/cobra.(*Command).execute(0x125cdc0, {0x12cd120, 0x0, 0x0})
    /path/to/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0x125d940)
    /path/to/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
    /path/to/cobra@v1.8.0/command.go:1039
github.com/getgauge/gauge/cmd.Parse()
    /path/to/gauge/cmd/cmd.go:112 +0x26
main.main()
    /path/to/gauge/gauge.go:19 +0x30

Get Support ----------------------------
    Docs:          https://docs.gauge.org
    Bugs:          https://github.com/getgauge/gauge/issues
    Chat:          https://github.com/getgauge/gauge/discussions

Your Environment Information -----------
    linux, 1.6.7, 684d870
    html-report (4.3.0), screenshot (0.2.0), ts (0.3.1)

Question

Is there any known workaround or solution for this issue? We are currently blocked due to this problem and would appreciate any guidance on how to resolve it.

Thank you for your support!

We are having the same problem. Gauge typescript plugin returns invalid memory address or nil pointer dereference after upgrading to version 0.3.1. It happens on all our environments including Windows, MacOS and when running in NodeJS Docker container.

I'm experiencing the same issue. In the meantime, I am just installing a working version prior to executing tests:

gauge install ts --version 0.1.1

there doesn't appear to be a way to pin plugins to a certain version.

Please make sure your gauge project's package.json has version 0.3.1 of gauge-ts package.

Thanks for pointing out the issue. There are significant changes to the TS plugin execution between versions 0.1.1 and 0.3.0, as mentioned above.

Please ensure that the plugin version 0.3.1 matches the package version.

The latest plugin is usually downloaded to:

~/.gauge/plugins/ts/

The gauge-ts package version is specified in the package.json file in your project's root folder, for example:

 "dependencies": {
    "gauge-ts": "0.3.1",
    "ts-node": "^10.9.2",
    "typescript": "^5.4.5"
  }

Remember to update the dependencies by running:

npm install

from the project root folder.