zitadel / zitadel-go

ZITADEL Go - The official client library of ZITADEL for an easy integration into your Go project.
https://zitadel.com
Apache License 2.0
73 stars 29 forks source link

received unexpected content-type \"application/json\" #282

Closed uppercaveman closed 7 months ago

uppercaveman commented 11 months ago

run example/auth

call failed: rpc error: code = Unimplemented desc = unexpected HTTP status code received from server: 404 (Not Found); transport: received unexpected content-type "application/json"

the client-go branch next not fully developed?

hifabienne commented 11 months ago

@livio-a can you help here?

uppercaveman commented 11 months ago

using postman tests is OK,but run example error

livio-a commented 10 months ago

Sorry missed the notification... do you still have the issue?

I tested using the next branch and could not reproduce Are you using zitadel.cloud or a self-hosted deployment?

schlapzz commented 8 months ago

I get the exact same error when I try to call the API with the client

Here is my example code. It is a self hosted instance

package main

import (
    "context"
    "fmt"

    "github.com/zitadel/oidc/pkg/oidc"

    "github.com/zitadel/zitadel-go/v2/pkg/client/middleware"
    zuser "github.com/zitadel/zitadel-go/v2/pkg/client/user/v2beta"
    "github.com/zitadel/zitadel-go/v2/pkg/client/zitadel"
    user "github.com/zitadel/zitadel-go/v2/pkg/client/zitadel/user/v2beta"
)

func main() {
    client, err := zuser.NewClient("https://mydomain.com", "mydomain.com:443", []string{oidc.ScopeOpenID, zitadel.ScopeZitadelAPI()}, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath("key.json")))
    if err != nil {
        panic(err)
    }

    username := "super-saiyan"

    resp, err := client.UpdateHumanUser(context.Background(), &user.UpdateHumanUserRequest{
        UserId:   "0002225165489161",
        Username: &username,
    })

    if err != nil {
        panic(err)
    }

    fmt.Println(resp.String())

}
schlapzz commented 7 months ago

@livio-a any updates on this one?

fforootd commented 7 months ago

Hm usually that error means that there is a network problem with the http2 connection not properly reaching zitadel.

Can you share your network setup (i.e. proxy config)?

schlapzz commented 7 months ago

@fforootd Xes you are right. The issue was the AWS ELB. After we switched to an AWS ALB with HTTP2/GRPC support, the error was gone.

fforootd commented 7 months ago

@fforootd Xes you are right. The issue was the AWS ELB. After we switched to an AWS ALB with HTTP2/GRPC support, the error was gone.

Perfect, nice to know!