Exafunction / codeium.el

Free, ultrafast Copilot alternative for Emacs
https://www.codeium.com
MIT License
412 stars 13 forks source link

Error running timer ‘codeium-defer-until-no-input’: (error "cannot get auth_token from res") #35

Open Spike-Leung opened 1 year ago

Spike-Leung commented 1 year ago

I use Emacs in WSL2 with Ubuntu, and I follow the README to config codeium.

Here is my config:

;;; init-codeium.el --- codeium config
;;; Commentary:
;;; Code:
(push (expand-file-name "lisp/my-lisp/codeium" user-emacs-directory) load-path)
(require 'codeium)

(with-eval-after-load 'codeium
  ;; codeium-completion-at-point is autoloaded, but you can
  ;; optionally set a timer, which might speed up things as the
  ;; codeium local language server takes ~0.2s to start up
  (add-hook 'emacs-startup-hook
            (lambda () (run-with-timer 0.1 nil #'codeium-init)))

  (add-to-list 'completion-at-point-functions #'codeium-completion-at-point)

  ;; get codeium status in the modeline
  (setq codeium-mode-line-enable
        (lambda (api) (not (memq api '(CancelRequest Heartbeat AcceptCompletion)))))
  (add-to-list 'mode-line-format '(:eval (car-safe codeium-mode-line)) t)
  ;; alternatively for a more extensive mode-line
  ;; (add-to-list 'mode-line-format '(-50 "" codeium-mode-line) t)

  ;; use M-x codeium-diagnose to see apis/fields that would be sent to the local language server
  (setq codeium-api-enabled
        (lambda (api)
          (memq api '(GetCompletions Heartbeat CancelRequest GetAuthToken RegisterUser auth-redirect AcceptCompletion))))

  ;; You can overwrite all the codeium configs!
  ;; for example, we recommend limiting the string sent to codeium for better performance
  (defun my-codeium/document/text ()
    (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (min (+ (point) 1000) (point-max))))
  (setq codeium/document/text 'my-codeium/document/text))

(provide 'init-codeium)

;;; init-codeium.el ends here

and my Emacs version:

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-12-13

In Emacs, when I call codeium-init, it will open Chrome and visit codeium try to get auth_token. But after I call codeium-init, it shows an error message immediately :

you can also use M-x codeium-kill-last-auth-url to copy the codeium login url
Error running timer ‘codeium-defer-until-no-input’: (error "cannot get auth_token from res")

For everytime call codeium-init, there is a log said: 'no status available' : image

After removing http_proxy and https_proxy, it keeps waiting for a response: image

It will open chrome installed on windows, and codeium is installed in WSL, is there some communication issue between chrome and codeium ?

Or Is something wrong with the network? Or can I visit the auth URL and set auth_token manually ?

FuyuriSeiichi commented 2 months ago

I experience this as well on Mac OS. I kind of expect in to be installed properly after "codeium-install".

esguti commented 1 month ago

The same happens to me. "codeium-install" gives me the output:

successfully installed codeium local language server
Error running timer ‘codeium-defer-until-no-input’: (wrong-number-of-arguments (2 . 2) 5)

I have emacs GNU Emacs 27.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20) of 2020-07-29 and Ubuntu 20.04.6 LTS

This is the output of the "codeium logs" after executing the command "codeium-install":

https://github.com/Exafunction/codeium/releases/download/language-server-v1.8.30/language_server_linux_x64.gz 8.81 secs status: 200
I0510 09:31:28.860706  9651 main.go:554] Starting language server manager with pid 9651
I0510 09:31:28.860820  9651 main.go:110] Manager acquired its lock file /tmp/codeium_nNgXej/locks/manager.lock
I0510 09:31:28.861284  9651 main.go:248] Waiting for random port file in /tmp/codeium_nNgXej/child_random_port_1715326288860935400_717980777593292915 to be created
I0510 09:31:29.039862  9661 main.go:548] Starting language server process with pid 9661
I0510 09:31:29.039930  9661 server.go:154] Language server will attempt to listen on host 127.0.0.1
I0510 09:31:29.039993  9661 server.go:161] Language server listening on random port at 38983
I0510 09:31:29.040036  9661 proxy.go:113] proxyplease.proxy> No proxy provided. Attempting to infer from system.
I0510 09:31:29.040049  9661 proxy.go:113] proxyplease.proxy> No proxy could be determined. Assuming a direct connection.
I0510 09:31:29.040065  9661 client.go:589] [DEBUG] GET https://server.codeium.com/exa.api_server_pb.ApiServerService/GetCompletions
I0510 09:31:29.453769  9661 unleash.go:90] Initializing Unleash
I0510 09:31:29.858943  9661 unleash.go:110] Successfully initialized Unleash
E0510 09:31:29.882399  9661 client_manager.go:262] Metadata is nil when trying to refresh user JWT
I0510 09:31:29.883451  9661 server.go:353] Successfully created API server client
I0510 09:31:29.931039  9661 server.go:362] Successfully initialized tokenizer
I0510 09:31:29.931171  9661 search_provider.go:164] Using database at /home/edgutierrez/.codeium/database/default/2/MODEL_EMBED_6591
I0510 09:31:29.931752  9661 search_provider.go:176] Successfully created embedding search database
I0510 09:31:29.931987  9661 search_provider.go:224] Successfully created embedding search provider
I0510 09:31:29.931995  9661 server.go:455] Successfully created exact search provider
I0510 09:31:29.935559  9661 server.go:483] Successfully created completion provider
I0510 09:31:29.935789  9661 server.go:555] Child process attempting to acquire lock file /tmp/codeium_nNgXej/locks/child_lock_1715326288860976752_5533526485488348460
I0510 09:31:29.935881  9661 server.go:565] Child process acquired lock file /tmp/codeium_nNgXej/locks/child_lock_1715326288860976752_5533526485488348460
I0510 09:31:29.970226  9651 main.go:284] Language server manager found random server port 38983
I0510 09:31:29.970258  9651 main.go:285] Language server manager found random lsp port 42101
I0510 09:31:29.970269  9651 main.go:292] Language server manager attempting to connect to language server at 127.0.0.1:38983
I0510 09:31:29.995015  9651 main.go:163] Fixing language server port at 38983
I0510 09:31:29.995038  9651 main.go:343] Language server manager successfully connected to new language server at 127.0.0.1:38983

This is the output of the "codeium logs" after executing the command "codeium-init":

Process codeium killed