Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unknown error: call function result missing int 'status' #1057

Open
kettanaito opened this issue Apr 21, 2022 · 6 comments
Open

unknown error: call function result missing int 'status' #1057

kettanaito opened this issue Apr 21, 2022 · 6 comments

Comments

@kettanaito
Copy link

Context

I'm trying to launch a VS Code window using Spectron. Here's the setup:

  app = new Application({
    path: vscodeExecutablePath,
    args: [
      "--no-sandbox",
      "--disable-updates",
      "--skip-welcome",
      "--skip-release-notes",
      "--disable-workspace-trust",
      `--extensionDevelopmentPath=${extensionPath}`,
    ],
    requireName: "nodeRequire",
  });

The VS Code version I'm launching is 1.66.2 with the following environment:

ersion: 1.66.2 (Universal)
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:49:20.994Z (1 wk ago)
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin arm64 21.2.0

I confirm that vscodeExecutablePath is correct as I see the window launching. Yet the app.start() throws the following error:

    [0   chromedriver                        0x0000000100cb8954 chromedriver + 4196692
    1   chromedriver                        0x0000000100c4bf64 chromedriver + 3751780
    2   chromedriver                        0x00000001008da894 chromedriver + 141460
    3   chromedriver                        0x00000001008dd230 chromedriver + 152112
    4   chromedriver                        0x00000001008dd0d8 chromedriver + 151768
    5   chromedriver                        0x00000001008dd948 chromedriver + 153928
    6   chromedriver                        0x000000010092cc78 chromedriver + 478328
    7   chromedriver                        0x000000010092c40c chromedriver + 476172
    8   chromedriver                        0x00000001008fd990 chromedriver + 285072
    9   chromedriver                        0x00000001008fe430 chromedriver + 287792
    10  chromedriver                        0x0000000100c78b40 chromedriver + 3935040
    11  chromedriver                        0x0000000100c91320 chromedriver + 4035360
    12  chromedriver                        0x0000000100c9601c chromedriver + 4055068
    13  chromedriver                        0x0000000100c91b68 chromedriver + 4037480
    14  chromedriver                        0x0000000100c6e7d8 chromedriver + 3893208
    15  chromedriver                        0x0000000100caada4 chromedriver + 4140452
    16  chromedriver                        0x0000000100caaf18 chromedriver + 4140824
    17  chromedriver                        0x0000000100cbf1a8 chromedriver + 4223400
    18  libsystem_pthread.dylib             0x0000000181cbd240 _pthread_start + 148
    19  libsystem_pthread.dylib             0x0000000181cb8024 thread_start + 8
    ] {
      name: 'unknown error'
    } unknown error: call function result missing int 'status'
      (Session info: chrome=98.0.4758.109)

Dependencies

{
  "spectron": "19.0.0"
}

Transient dependencies:

  └─┬ spectron@19.0.0
    └── webdriverio@7.16.13

  └─┬ spectron@19.0.0
    └── electron-chromedriver@17.0.0

Things I've tried

  • Ensured I'm using the correct Spectron version in regards to the Electron version I'm trying to render.
  • Ensured I'm using the correct chromedriver (you can see in the error trace that the version of the chromedriver and the Chromium version used by VS Code are the same).

Expected behavior

I can launch the given VS Code executable without issues.

@kettanaito
Copy link
Author

Let me know if there's anything you can advise from the issue description alone. If not, I will try to create a reproduction repository for this.

@kettanaito
Copy link
Author

kettanaito commented Apr 26, 2022

When I ran chromedriver binary as proposed here, I was able to see a more descriptive error when I ran Spectron:

[6018:0426/132641.654820:INFO:CONSOLE(1)] "TypeError: setTimeout(...).unref is not a function
    at IncomingMessage.<anonymous> (/vscode-extension/.vscode-test/vscode-darwin-1.66.2/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/applicationinsights/out/Library/Sender.js:100:117)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)", source: vscode-file://vscode-app/vscode-extension/.vscode-test/vscode-darwin-1.66.2/Visual%20Studio%20Code.app/Contents/Resources/app/out/bootstrap-window.js (1)

Looks like Spectron runs Chromedriver, which executes VS Code and fails on some setTimeout(...).unref usage.

Update: This exception seems to be gone if I pass the --disable-telemetry option to the Spectron args (forwarded to the vscode instance). Unfortunately, doesn't seem related.

@kettanaito
Copy link
Author

kettanaito commented Apr 26, 2022

The error itself originates from Chromedriver and its ParseCallFunctionResult function:

Status ParseCallFunctionResult(const base::Value& temp_result,
--
  | std::unique_ptr<base::Value>* result) {
  | const base::DictionaryValue* dict;
  | if (!temp_result.GetAsDictionary(&dict))
  | return Status(kUnknownError, "call function result must be a dictionary");
  | absl::optional<int> status_code = dict->FindIntKey("status");
  | if (!status_code) {
  | return Status(kUnknownError,

  // RIGHT HERE
  | "call function result missing int 'status'");

  | }
  | if (*status_code != kOk) {
  | std::string message;
  | dict->GetString("value", &message);
  | return Status(static_cast<StatusCode>(*status_code), message);
  | }
  | const base::Value* unscoped_value = dict->FindKey("value");
  | if (unscoped_value == nullptr) {
  | // Missing 'value' indicates the JavaScript code didn't return a value.
  | return Status(kOk);
  | }
  | *result = base::Value::ToUniquePtrValue(unscoped_value->Clone());
  | return Status(kOk);
  | }

But I fail to spot what sets the "status" key in the "dict". There are no explicit calls of .Set("status" in the codebase. I suspect the status is set implicitly, for example, inherited from an HTTP call or a process status.

Here's a call stack for this function:

- CallFunction
  - CallFunctionWithTimeout
    - ParseCallFunctionResult (throws error)

I wish I could see how the CallFunction is called in the case when the error occurs but I lack the tools/knowledge to perform C++ debugging.

@arossetter
Copy link

Hi @kettanaito, have you by chance made any headway on this? I'm actually running into the exact same error with spectron v18 and electron v16. If you found a solution I'd love to know what it is. :)

@kettanaito
Copy link
Author

Hey, @arossetter. Alas, I'm stuck on this as well. Sadly, there's been no replies from the project's maintainers. I'd really love to hear some suggestions on how to debug this at least. Same here: if you find anything that moves you forward please let me know!

@arossetter
Copy link

@kettanaito we're not likely to get replies from the maintainers as Spectron is deprecated (#1045) but I'll definitely return here if I figure something out on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants