'argocd login is failing with "received the unexpected content-type" error

When attempting to login using CLI, I get an error

FATA[0004] rpc error: code = Internal desc = transport: received the unexpected content-type "text/plain; charset=utf-8"

Here is our Ingress config:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: argocd-server-ingress
  namespace: argocd
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  tls:
    - hosts:
      - argocd.foo.dev
      secretName: argocd-foo-dev-tls
  rules:
    - host: argocd.foo.dev
      http:
        paths:
        - backend:
            serviceName: argocd-server
            servicePort: https
          path: /

The web UI works as expected.

I am using command:

argocd login argocd.foo.dev

What is missing?



Solution 1:[1]

While I am not 100% what is the reason for the above error, using --grpc-web works around it:

argocd login argocd.foo.dev --grpc-web

Documentation says that this flag is needed when HTTP2 is not supported:

Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2.

In our case, our ingress controller is and it does support .

Solution 2:[2]

You need to login first:

argocd login localhost:8080

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gajus
Solution 2 O?uzcan Budumlu