Skip to content

`GitLab: Open active file on GitLab` command fails

Summary

Since v3.3.0, using the GitLab: Open active file on GitLab command fails with a few error messages.

Steps to reproduce

  1. Ensure VSCode 1.49.3 is installed
  2. Ensure GitLab Workflow extension v3.3.0 is installed
  3. Setup GitLab Workflow extension using gitlab.com and a PAT
  4. Open a GitLab project git checkout, I used a checkout of https://gitlab.com/gitlab-org/gitlab-development-kit
  5. Open any file, I used lib/gdk/config.rb
  6. This is the key Ensure you have a file:// type git remote configured in the git checkout's .git/config
  7. Bring up the command palette (CMD+SHIFT+P on macOS)
  8. Type in GitLab: Open active file on GitLab and press ENTER
  9. Observe errors

What is the current bug behavior?

Unable to open 'undefined': Unable to read file '/undefined' (Error: Unable to resolve non-existing file '/undefined').

And

API request failed when trying to get current project because: parseGitRemote is not a function or its return value is not iterable

And log output:

{
  "message": "API request failed when trying to get current project because: parseGitRemote is not a function or its return value is not iterable",
  "stack": [
    "Error: API request failed when trying to get current project because: parseGitRemote is not a function or its return value is not iterable",
    "    at Object.fetchCurrentProject (/Users/ash/.vscode/extensions/gitlab.gitlab-workflow-3.3.0/src/gitlab_service.js:164:11)",
    "    at runMicrotasks (<anonymous>)",
    "    at processTicksAndRejections (internal/process/task_queues.js:94:5)",
    "    at getActiveFile (/Users/ash/.vscode/extensions/gitlab.gitlab-workflow-3.3.0/src/openers.js:66:22)",
    "    at openActiveFile (/Users/ash/.vscode/extensions/gitlab.gitlab-workflow-3.3.0/src/openers.js:89:17)",
    "    at /Users/ash/.vscode/extensions/gitlab.gitlab-workflow-3.3.0/src/extension.js:29:5"
  ]
}

What is the expected correct behavior?

https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/master/lib/gdk/config.rb should be opened in active browser.

Relevant logs and/or screenshots

config.rb___gdk-primary_2020-10-06_10-46-40

screencast_2020-10-06_10-54-00

Possible fixes

!111 (closed)

Edited by Ash McKenzie