#Unable to connect to Convex through CLI

5 messages · Page 1 of 1 (latest)

safe birch
#

I have been using Convex for a few weeks now. Somehow my local machine got logged out and now when I try to login again through the CLI I get the following error:
Unknown error during authorization: Error: Error fetching POST https://api.convex.dev/api/deployment/provision_and_authorize 401 Unauthorized: AuthenticationFailed: A valid access token is required for this command.

I have tried logging out and back in various ways but to no avail. Any suggestions or troubleshooting to resolve this issue? I'm able to log in to the Convex dashboard just fine.

hollow cometBOT
#

Hi @safe birch. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information in the knowledge sources, there are a few troubleshooting steps and observations relevant to your issue:

  1. CLI Login Issues: There have been reports of the Convex CLI hanging or failing during login, especially on certain operating systems like Ubuntu. One workaround suggested is to avoid opening the browser automatically during CLI login. If prompted, type "no" to use a different authentication flow that doesn't require the browser to open automatically. If you manually open the link provided by the CLI, it sometimes does not resolve the issue, so using the alternative flow is recommended in these cases Discord: Problem when login.

  2. Network and Authorization Errors: Several users have encountered network-related or authorization errors when using the CLI, even when the dashboard is accessible. These issues can sometimes be related to VPNs, unusual network setups, or public WiFi. If you are on a VPN or a non-standard network, try switching to a different network or disabling the VPN to see if that resolves the issue Discord: Your request couldn't be completed. Try again later, Discord: Can u any help me fixing this network error?.

  3. CLI Logout and Re-login: You can try explicitly logging out using npx convex logout and then logging in again. This removes existing credentials and can sometimes resolve authentication issues CLI documentation.

#
  1. Operating System Issues: If you are using WSL, Linux, or a similar environment, there may be additional networking or compatibility issues. Some users have reported that switching networks or environments (e.g., from mobile hotspot to home WiFi) can affect connectivity Discord: convex dev can't reach server.

  2. No Explicit Solution for 401 Error: The knowledge sources do not provide a direct solution for the specific 401 Unauthorized error you are seeing during CLI login. However, the above steps are the most common troubleshooting approaches discussed in the community.

If none of these steps resolve your issue, and you are still able to access the Convex dashboard but not the CLI, it may be a temporary server-side or account-specific issue. In such cases, reaching out to Convex support (as you have done) is the recommended next step.

I'm sorry, but the knowledge sources do not contain a definitive solution for your exact error. If you continue to experience issues, please provide additional details about your environment (OS, CLI version, network setup) when contacting support, as this can help them diagnose the problem more effectively.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@safe birch Kapa.ai is still learning and improving, please let me know how I did by reacting below.