copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.79k stars 126 forks source link

login not working #126

Closed cenedella closed 1 year ago

cenedella commented 1 year ago

Mac, Node 19.9.0 installed

copilot-events:

`[client-request] (id:1) Sun Apr 16 18:17:58 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:capabilities 'nil))
[stderr] node:internal/modules/cjs/loader:936
[stderr] throw err;
[stderr] ^
[stderr]
[stderr] Error: Cannot find module '/Users/.emacs.d/elpa/copilot-20230406.10302/dist/agent.js' [stderr] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
[stderr] at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[stderr] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
[stderr] at node:internal/main/run_main_module:17:47 {
[stderr] code: 'MODULE_NOT_FOUND',
[stderr] requireStack: []
[stderr] }
[stderr]
[stderr] Node.js v17.1.0
[internal] Sun Apr 16 18:17:58 2023:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

stderr

`1Debugger entered--Lisp error: (jsonrpc-error "request id=1 failed:" (jsonrpc-error-code . -1) (jsonrp$ 2 signal(jsonrpc-error ("request id=1 failed:" (jsonrpc-error-code . -1) (jsonrpc-error-message . "Se$ 3 jsonrpc-request(# initialize (:$ 4 copilot--start-agent()
5 copilot-login()
6 funcall-interactively(copilot-login)
7 call-interactively(copilot-login record nil)
8 command-execute(copilot-login record)
9 execute-extended-command(nil "copilot-login" "copilot-logi")
10 funcall-interactively(execute-extended-command nil "copilot-login" "copilot-logi")
11 call-interactively(execute-extended-command nil nil)
12 command-execute(execute-extended-command)

----------b---y---e---b---y---e---------- `

zerolfx commented 1 year ago

Try node /path/to/copilot.el/dist/agent.js in your terminal.

(It seems that you may have forgotten to download the 'dist' directory.)

cenedella commented 1 year ago

Yeah, I tried that, but it was strange that copilot-mode was working toggle on and toggle off.

Following @proul-x behavior here: https://github.com/zerolfx/copilot.el/issues/65

I uninstalled and reinstalled copilot. Which also ended up with me having to uninstall and reinstall elpy

That worked.

Thanks for this great port, and thanks for the comment @zerolfx !

zerolfx commented 1 year ago

It's great to see that the problem has been resolved.

However, I'm still unclear about what happened with elpy. It seems that copilot.el doesn't have any interaction with elpy.

cenedella commented 1 year ago

Which node does copilot.el require? I ended up having to upgrade from ~17 to 19.9.0 in middle of installation. Could that have caused the problem?

zerolfx commented 1 year ago

Which node does copilot.el require? I ended up having to upgrade from ~17 to 19.9.0 in middle of installation. Could that have caused the problem?

>= Node 16

zerolfx commented 1 year ago

If you still have the problem, please try running node /path/to/copilot.el/dist/agent.js in your terminal and paste the output in this thread.

13tales commented 1 year ago

I am having a similar problem. In my case, the agent process seems to be exiting. I'm using Spacemacs, with Emacs 28.2. My node is version 19.6.1.

----------b---y---e---b---y---e---------- [stderr] [stderr] [stderr] nil [stderr] nil [stderr] Process copilot agent stderr finished [stderr] [stderr] [stderr] nil [stderr] nil [stderr] Process copilot agent stderr finished

- When I manually run the agent process from the terminal, I see the following:

Content-Length: 232

{"jsonrpc":"2.0","method":"LogMessage","params":{"level":0,"message":"[DEBUG] [agent] [2023-04-18T23:53:01.456Z] Agent service starting","metadataStr":"[DEBUG] [agent] [2023-04-18T23:53:01.456Z]","extra":["Agent service starting"]}}

zerolfx commented 1 year ago

@13tales

Running copilot-diagnose will initiate a restart of the agent. In order to view the complete details of *copilot events*, kindly set copilot-log-max to nil.

Based on my understanding, if you receive an error message stating "Not authenticated: NotAuthorized", it implies that you do not have a Copilot subscription. (If you forget to log in, the error message should be Not authenticated: NotSignedIn.)

13tales commented 1 year ago

@13tales

Running copilot-diagnose will initiate a restart of the agent. In order to view the complete details of *copilot events*, kindly set copilot-log-max to nil.

Based on my understanding, if you receive an error message stating "Not authenticated: NotAuthorized", it implies that you do not have a Copilot subscription. (If you forget to log in, the error message should be Not authenticated: NotSignedIn.)

Ugh. You're right, sorry 🤦‍♂️ My workplace is trialling it, so when the login process appeared to work, I'd assumed I already had access through them.

This might be a good thing to put in the readme, since the difference between NotAuthorized and NotSignedIn might not be immediately obvious.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.