vscode-github-actions: Cannot log in to GitHub actions

Describe the bug It is not possible to log in to Github actions. Even if I try to with the refresh button, it won’t work.

To Reproduce Steps to reproduce the behavior:

  1. Open Github Actions extension
  2. Click on log in
  3. Afterwards it will show up in the extension that it was Unable to connect to the GitHub API, please check your internet connection.
  4. (Optional) See error in the output log when you click on refresh button in the extension Cannot fetch github context Error: Cannot fetch github context

Expected behavior I expected to be logged in to my GitHub account and se my actions in the repository I’m working on

Screenshots

From the output log Skärmavbild 2023-08-21 kl  16 27 05

From the extension Skärmavbild 2023-08-21 kl  16 26 48

Extension Version v0.26.1

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Reactions: 14
  • Comments: 27

Most upvoted comments

Same issue here with Github Enterprise and SAML Auth.

Cannot fetch github context
Error: Cannot fetch github context
    at vt (c:\Users\user\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1444927)
    at Bt (c:\Users\user\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1445257)
    at Os (c:\Users\user\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1637593)
    at v.n (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:6205)
    at v.m (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:6168)
    at v.l (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:5625)
...initialized

Same issue with me. The GitHub Actions Output tab:

Activating GitHub Actions extension...
Error getting GitHub context
Not Found
HttpError: Not Found
	at c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.1\dist\extension-node.js:2:1366275
	at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.1\dist\extension-node.js:2:1444089
	at async Promise.all (index 0)
	at async c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.1\dist\extension-node.js:2:1444005
	at async c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.1\dist\extension-node.js:2:1443637
	at async vt (c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.1\dist\extension-node.js:2:1443574)
	at async Os (c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.1\dist\extension-node.js:2:1624463)
	at async p.n (c:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:6206)
	at async p.m (c:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:6169)
	at async p.l (c:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:5626)

Few things worth mentioning:

  1. The extension works for repositories in other organizations
  2. The organization where the extension does not work has SAML SSO enabled

For that org, the Output tab for GitHub (not GitHub Actions) says:

Failed to update repository branch protection: Request failed due to following response errors:
 - Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization.

I have found a solve to this issue.

There is an extension in VS code called “win-ca” that is used to map local certifications into VS code including GitHub. This is for windows users only. For mac users, use “Mac CA VSCode”. I was able to set the config of that extension to append certs (defaults to replace) and it now allows me to fetch the GitHub API when cloning a repository and using the GitHub Actions extension in VS code.

My issue occurred only when I was on our companies VPN but works fine now with the extension I listed above.

Windows: https://marketplace.visualstudio.com/items?itemName=ukoloff.win-ca MAC: https://marketplace.visualstudio.com/items?itemName=linhmtran168.mac-ca-vscode

I see this issue when VSCode has a workspace open.

If I open an individual project I have no issue.

Version v0.26.1

# from Window output when clicking refresh
2023-08-23 12:39:14.055 [error] command 'github-actions.explorer.refresh' not found: Error: command 'github-actions.explorer.refresh' not found
    at b.k (vscode-file://vscode-app/.../AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1669:3069)
    at b.executeCommand (vscode-file://vscode-app/.../AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1669:2985)
    at async i.open (vscode-file://vscode-app/.../AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:616:40250)
    at async d.open (vscode-file://vscode-app/.../AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:616:41761)

# from Github Actions output
Activating GitHub Actions extension...
Error getting GitHub context
Not Found
HttpError: Not Found
	at /home/{user}/.vscode-server/extensions/github.vscode-github-actions-0.26.1/dist/extension-node.js:2:1366275
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async /home/{user}/.vscode-server/extensions/github.vscode-github-actions-0.26.1/dist/extension-node.js:2:1444089
	at async Promise.all (index 3)
	at async /home/{user}/.vscode-server/extensions/github.vscode-github-actions-0.26.1/dist/extension-node.js:2:1444005
	at async /home/{user}/.vscode-server/extensions/github.vscode-github-actions-0.26.1/dist/extension-node.js:2:1443637
	at async vt (/home/{user}/.vscode-server/extensions/github.vscode-github-actions-0.26.1/dist/extension-node.js:2:1443574)
	at async Os (/home/{user}/.vscode-server/extensions/github.vscode-github-actions-0.26.1/dist/extension-node.js:2:1624463)
	at async w.n (/home/{user}/.vscode-server/bin/1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a/out/vs/workbench/api/node/extensionHostProcess.js:92:7006)
	at async w.m (/home/{user}/.vscode-server/bin/1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a/out/vs/workbench/api/node/extensionHostProcess.js:92:6969)
	at async w.l (/home/{user}/.vscode-server/bin/1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a/out/vs/workbench/api/node/extensionHostProcess.js:92:6426)

Update: After testing with my VSCode workspace. I discovered the issue occurs when there is a folder in the workspace that has been git init but has not had a git remote added.

I also have this same issue:

Activating GitHub Actions extension...
Error getting GitHub context
Bad credentials
HttpError: Bad credentials
    at /Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1366400
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1447997
    at Object.get (/Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1447724)
    at Lt (/Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1447916)
    at Os (/Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1624572)
    at u.n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6255)
    at u.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6218)
    at u.l (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5675)

Cannot fetch github context
Error: Cannot fetch github context
    at vt (/Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1444927)
    at Os (/Users/alexshaw/.vscode/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1624588)
    at u.n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6255)
    at u.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6218)
    at u.l (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5675)

I have a Macbook with an Intel chip. Other GitHub extensions work fine, e.g. GitHub Copilot

I seem to receive a similar, but not identical error in my GitHub Actions extension output:

Error getting GitHub context
fetch failed
HttpError: fetch failed
	at c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1366802
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1447997
	at async Object.get (c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1447724)
	at async Lt (c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1447916)
	at async c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1626346
	at async n.h (c:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:84275)

Cannot fetch github context
Error: Cannot fetch github context
	at vt (c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1444927)
	at async c:\Users\<user>\.vscode\extensions\github.vscode-github-actions-0.26.2\dist\extension-node.js:2:1626446
	at async n.h (c:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:84275)

Meanwhile my GitHub extension output is:

2023-10-13 10:29:49.462 [info] Log level: Info
2023-10-13 10:29:52.627 [warning] Failed to update repository branch protection: No GitHub authentication session available.
2023-10-13 10:29:59.528 [warning] Failed to update repository branch protection: No GitHub authentication session available.
2023-10-13 10:30:28.560 [warning] Failed to update repository branch protection: No GitHub authentication session available.

The GitHub Pull Requests and Issues extensions appears to work without issue. It is only GitHub Actions that fails, the same way as the initial issue. This is for an Enterprise org as well, however no GitHub Enterprise URI is required.

When I click the “Refresh” button in the GitHub Actions extension, I can see it use the GitHub Authentication extension to successfully get the session:

2023-10-13 10:40:48.493 [info] Getting sessions for repo,workflow...
2023-10-13 10:40:48.493 [info] Got 1 sessions for repo,workflow...

I had same issue. But after upgrading to 1.87.0-insider commit: 01f46bb5357baa8f3b9da690e1e34eb78e09a72b, it no longer reproduces.

I started experiencing this issue after I upgraded to 1.87.0-insider (8fa84589) a couple of days ago. It had been working just fine for months before the upgrade.

The issue is present on both my M2 Mac (Sonoma 14.2.1) and my Windows 11 Pro (version 23H2). As others describe, only the GitHub.vscode-github-actions extension is affected; I’m successfully using all of the following:

I’m seeing the same traceback as others have shared:

Error: Cannot fetch github context
    at vt (/home/bryantfinney/.vscode-server-insiders/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1444927)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/bryantfinney/.vscode-server-insiders/extensions/github.vscode-github-actions-0.26.2/dist/extension-node.js:2:1626446
    at s.h (/home/bryantfinney/.vscode-server-insiders/bin/8fa84589eef3538dbc763ff98dc7d5a8a0c56374/out/vs/workbench/api/node/extensionHostProcess.js:150:178999

Probably not the same issue. In my case, clicking “Sign in to GitHub” prints this error in the Developer Tools console:

  ERR command 'github-actions.sign-in' not found: Error: command 'github-actions.sign-in' not found
    at y.n (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1537:12331)
    at y.executeCommand (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1537:12260)
    at async i.open (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:645:41218)
    at async u.open (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:645:42600)
  • OS: Ubuntu 20.04.6 LTS
  • GitHub Actions v0.26.2
  • VS Code
    • 1.84.2
    • 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
    • x64

The git authentication config was not the problem. I thought that the problem lied there because I’ve had problems pushing GitHub action workflow files from VS Code. When I finally set up the git auth config, I could push commits that had the github actions workflow files, and then I thought that the git auth config might be the solution to the Github actions extension too. But it was not. I’m greeted with no context in the output and could not connect to the Github API.

It might be the git authenticaton configuration that might be the problem because I have also the problem to push workflow files in VS Code and in an external terminal.