Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read framer head magic 18516 != 2352, not match. #44

Closed
adamgajzlerowicz opened this issue Jul 28, 2024 · 2 comments
Closed

read framer head magic 18516 != 2352, not match. #44

adamgajzlerowicz opened this issue Jul 28, 2024 · 2 comments

Comments

@adamgajzlerowicz
Copy link

adamgajzlerowicz commented Jul 28, 2024

I am trying to make a TypeScript server and a Go client work together, but they are not compatible.

I created a minimal repository where I tried to integrate them:

https://github.com/adamgajzlerowicz/trcp-cross-lang

What version of trpc-cmdline are you using?

trpc-group/trpc-cmdline version: v1.0.9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/adam/Library/Caches/go-build'
GOENV='/Users/adam/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/adam/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/adam/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/opt/go/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/fn/y1cjv_7s7qqbqnfq2th2dfkm0000gn/T/go-build2990487295=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I am looking for a way to generate a TypeScript-based server from a proto file and a Golang client using the same proto file.

I created a proto file, and generated the backend code. Then I generated the Go code, but whenever I try to make a connection, I get an error.

What did you expect to see?

I expected to see data returned by the server.

What did you see instead?

Error:

read framer head magic 18516 != 2352, not match
2024-07-28 12:34:08.932 ERROR [email protected]/log.go:240 client request:/appRouter.AppRouter/ById, cost:620.334µs, to:127.0.0.1:3000, err:type:framework, code:171, msg:tcp client transport ReadFrame: trpc framer: read framer head magic 18516 != 2352, not match
2024-07-28 12:34:08.932 FATAL client/main.go:24 err: type:framework, code:171, msg:tcp client transport ReadFrame: trpc framer: read framer head magic 18516 != 2352, not match

Questions:

  • Are the servers meant to be compatible in this way?
  • Can you recommend how to make it work or suggest a compatible solution?

Many thanks.

@WineChord
Copy link
Contributor

Are you using https://github.com/trpc/trpc as the server? Although we have the same name, we are different projects. Our client cannot connect to their server. The error indicates that the server is running in HTTP protocol (magic 18516), and the trpc magic number required is 2352.

For those who are curious, 2352 is the decimal representation of 0x930. The number 18516, when converted to its hexadecimal representation and decoded to ASCII, is HT (which is the beginning two characters of an HTTP response).

@adamgajzlerowicz
Copy link
Author

adamgajzlerowicz commented Jul 29, 2024

Thank you so much for looking into this.
I was pulling my hair trying to get this those two to work together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants