mailchain/mailchain-legacy

Bug: Mainnet public-key endpoint returns: invalid character '\u003c' looking for beginning of value

Opened this issue · 1 comments

Describe the bug

Intermittently, when I call the public-key endpoint on Mainnet, I get the following error:

{"code":500,"message":"invalid character '\u003c' looking for beginning of value"}

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'http://127.0.0.1:8080/api/public-key?protocol=ethereum&network=mainnet&address=0x4AD2b251246aAFC2F3bDf3B690DE3bf906622c51'
  2. See error

What version of Mailchain are you using ?
$ mailchain version
Version: v0.0.48

Expected behavior

Response should be the same as ropsten:

{"public-key":"0x4724198e88535f9c8755178abd396d2ce4448f904c99896b69bdf89f0b764fd63dd826333b48987fef02822a8136dcb04e3c2d3f9e2dc19f6e9d8fe5ba7987d6","public-key-encoding":"hex/0x-prefix","public-key-kind":"secp256k1","supported-encryption-types":["aes256cbc","noop"]}

More info
From the console:

ERRO[2020-03-21T13:21:51Z] status 500: invalid character '<' looking for beginning of value
github.com/mailchain/mailchain/internal/clients/blockscout.APIClient.getTransactionsByAddress
	/go/src/github.com/mailchain/mailchain/internal/clients/blockscout/api.go:79
github.com/mailchain/mailchain/internal/clients/blockscout.APIClient.PublicKeyFromAddress
	/go/src/github.com/mailchain/mailchain/internal/clients/blockscout/pubkey_finder.go:35
github.com/mailchain/mailchain/cmd/mailchain/internal/http/handlers.GetPublicKey.func1
	/go/src/github.com/mailchain/mailchain/cmd/mailchain/internal/http/handlers/pubkey.go:60
net/http.HandlerFunc.ServeHTTP
	/usr/local/go/src/net/http/server.go:2007
github.com/gorilla/mux.(*Router).ServeHTTP
	/go/pkg/mod/github.com/gorilla/mux@v1.7.1/mux.go:212
github.com/urfave/negroni.Wrap.func1
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46
github.com/urfave/negroni.HandlerFunc.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
github.com/urfave/negroni.middleware.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
github.com/rs/cors.(*Cors).ServeHTTP
	/go/pkg/mod/github.com/rs/cors@v1.7.0/cors.go:252
github.com/urfave/negroni.middleware.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
github.com/urfave/negroni.(*Negroni).ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2802
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1890
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357
github.com/mailchain/mailchain/internal/clients/blockscout.APIClient.PublicKeyFromAddress
	/go/src/github.com/mailchain/mailchain/internal/clients/blockscout/pubkey_finder.go:37
github.com/mailchain/mailchain/cmd/mailchain/internal/http/handlers.GetPublicKey.func1
	/go/src/github.com/mailchain/mailchain/cmd/mailchain/internal/http/handlers/pubkey.go:60
net/http.HandlerFunc.ServeHTTP
	/usr/local/go/src/net/http/server.go:2007
github.com/gorilla/mux.(*Router).ServeHTTP
	/go/pkg/mod/github.com/gorilla/mux@v1.7.1/mux.go:212
github.com/urfave/negroni.Wrap.func1
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46
github.com/urfave/negroni.HandlerFunc.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
github.com/urfave/negroni.middleware.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
github.com/rs/cors.(*Cors).ServeHTTP
	/go/pkg/mod/github.com/rs/cors@v1.7.0/cors.go:252
github.com/urfave/negroni.middleware.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
github.com/urfave/negroni.(*Negroni).ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2802
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1890
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357
github.com/mailchain/mailchain/cmd/mailchain/internal/http/handlers.GetPublicKey.func1
	/go/src/github.com/mailchain/mailchain/cmd/mailchain/internal/http/handlers/pubkey.go:66
net/http.HandlerFunc.ServeHTTP
	/usr/local/go/src/net/http/server.go:2007
github.com/gorilla/mux.(*Router).ServeHTTP
	/go/pkg/mod/github.com/gorilla/mux@v1.7.1/mux.go:212
github.com/urfave/negroni.Wrap.func1
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46
github.com/urfave/negroni.HandlerFunc.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
github.com/urfave/negroni.middleware.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
github.com/rs/cors.(*Cors).ServeHTTP
	/go/pkg/mod/github.com/rs/cors@v1.7.0/cors.go:252
github.com/urfave/negroni.middleware.ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
github.com/urfave/negroni.(*Negroni).ServeHTTP
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2802
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1890
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357 
stale commented

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Mailchain team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please reply in order to keep the issue open. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.