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

nimbus-eth1 does not work with Metamask wallet #1141

Closed
hmel opened this issue Jun 26, 2022 · 5 comments · Fixed by #1992
Closed

nimbus-eth1 does not work with Metamask wallet #1141

hmel opened this issue Jun 26, 2022 · 5 comments · Fixed by #1992
Labels
hard RPC JSON-RPC over HTTP/websocket

Comments

@hmel
Copy link
Contributor

hmel commented Jun 26, 2022

Metamask wallet starts by issuing a OPTIONS / HTTP/1.1 which nimbus responds to with an error

HTTP/1.1 200 OK
Content-Length: 107
Content-Type: text/html; charset=utf-8
Date: Sun, 26 Jun 2022 18:06:05 GMT
Connection: keep-alive

{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"input(1, 0) Error: { expected","data":null}}

Metamask loops on this until timing out and is not able to connect.
Geth responds with

Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: POST
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 600
Content-Encoding: gzip
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: Sun, 26 Jun 2022 18:13:29 GMT
Content-Length: 23
@hmel hmel changed the title Work with Metamask wallet nimbus-eth1 does not work with Metamask wallet Jun 26, 2022
@jangko
Copy link
Contributor

jangko commented Jun 27, 2022

@hmel, can you also post the metamask wallet complete request header and body? because there is possibility it is a json-rpc's bug.

@hmel
Copy link
Contributor Author

hmel commented Jun 27, 2022

OPTIONS / HTTP/1.1
Host: localhost:8545
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Origin: moz-extension:https://3e7af72b-3e97-4bdd-9a90-f26da6856402
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site

@jangko
Copy link
Contributor

jangko commented Jun 27, 2022

I see, this is obviously json-rpc problem, it does not recognize both OPTIONS / and empty body.

@zah
Copy link
Contributor

zah commented Jun 27, 2022

FWIW, I've added CORS support for the nimbus-eth2 REST API in the following PR:
status-im/nimbus-eth2#3378

Looks like something similar will have to be done here as well.

@jangko
Copy link
Contributor

jangko commented Jul 26, 2022

All HTTP local services in nimbus-eth1 have been upgraded to support CORS for both simple and preflighted request.
Only websocket services still need upgrade, see status-im/nim-websock#121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hard RPC JSON-RPC over HTTP/websocket
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants