urbit / bridge

An application for interacting with Azimuth.
MIT License
95 stars 25 forks source link

Unable to run bridge locally due to failed external requests (CORS) #1070

Open mikolajpp opened 1 year ago

mikolajpp commented 1 year ago

Describe the bug I followed the guide and installed latest version of bridge, running it locally. However, it does not work in firefox due to failed external requests.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://roller.urbit.org/v1/roller. (Reason: CORS request did not succeed). Status code: (null).

As a result, the log in functionality does not work.

Desktop

sambarnes commented 1 year ago

seeing the same here when running locally

OSX, chrome, bridge-3.2.2, rainbow wallet

so login always hits {"code":7979,"data":{}}


this was after trying to use the hosted bridge to initialize my network keys

but it failing due to not supporting eip1559: invalid object key - maxFeePerGas (argument="transaction:maxFeePerGas",

so i figured maybe the hosted version was out of date and would try locally on latest

tomholford commented 1 year ago

Describe the bug I followed the guide and installed latest version of bridge, running it locally. However, it does not work in firefox due to failed external requests.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://roller.urbit.org/v1/roller. (Reason: CORS request did not succeed). Status code: (null).

As a result, the log in functionality does not work.

Desktop

  • OS: Linux
  • Browser: firefox 101.0.1

@mikolajpp What commands are you using to run Bridge locally? Are you able to connect to the site using https?

tomholford commented 1 year ago

seeing the same here when running locally

OSX, chrome, bridge-3.2.2, rainbow wallet

so login always hits {"code":7979,"data":{}}

this was after trying to use the hosted bridge to initialize my network keys

but it failing due to not supporting eip1559: invalid object key - maxFeePerGas (argument="transaction:maxFeePerGas",

so i figured maybe the hosted version was out of date and would try locally on latest

@sambarnes I also had issues with Rainbow when testing 3.2.2 locally. I ended up switching to another wallet (Trust) which worked as expected. Are you able to try another wallet?

In the meantime, I filed an issue for the Rainbow team: https://github.com/rainbow-me/rainbow/issues/4387

chaserene commented 8 months ago

I have the same issue.

Firefox 115.4.0esr Metamask 11.4.1 Bridge 3.2.4 (not the latest because, as of now, this is the latest version that has a non-source code release available for download. all source code releases fail for me with a MIME type error in the browser console.)

notably, the same setup but using the urbit.org bridge instead of the self-hosted one works, so I guess this is not due to the roller being offline.

(edited) the opening screen is displayed, I choose to log in with Metamask, sign the message, then I get this error on the website:

{"code":7979,"data":{}}
Try reloading the page. If this problem persists, please file an issue on GitHub.

the browser console is flooded with errors about not being able to reach Walletconnect, which I don't think affects me because I'm not using it. the errors that do seem relevant that appear after I click on the Metamask button are below:

XHROPTIONS
https://roller.urbit.org/v1/roller
CORS Missing Allow Origin
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://roller.urbit.org/v1/roller. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 404.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://roller.urbit.org/v1/roller. (Reason: CORS request did not succeed). Status code: (null).
failed to fetch controlled points Error: NetworkError when attempting to fetch resource.
    it http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    sendData http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    dt http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    ot http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    dt http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    promise callback*ct http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    b http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    b http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    sendData http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    request http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    mt http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    ut http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    tt http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    tt http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    request http://127.0.0.1:5000/assets/index.c6214be6.js:4865
    request http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    dt http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    ot http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    ot http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    promise callback*ct http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    7 http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    7 http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    request http://127.0.0.1:5000/assets/index.c6214be6.js:4866
    request http://127.0.0.1:5000/assets/index.c6214be6.js:4881
    getOwnedPoints http://127.0.0.1:5000/assets/index.c6214be6.js:4881
    Rt http://127.0.0.1:5000/assets/index.c6214be6.js:5411
    ot http://127.0.0.1:5000/assets/index.c6214be6.js:5411
    useControlledPointsStore http://127.0.0.1:5000/assets/index.c6214be6.js:5411
    fk http://127.0.0.1:5000/assets/index.c6214be6.js:39
    unstable_runWithPriority http://127.0.0.1:5000/assets/index.c6214be6.js:24
    gg http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Oj http://127.0.0.1:5000/assets/index.c6214be6.js:39
    Lj http://127.0.0.1:5000/assets/index.c6214be6.js:37
    jg http://127.0.0.1:5000/assets/index.c6214be6.js:35
    unstable_runWithPriority http://127.0.0.1:5000/assets/index.c6214be6.js:24
    gg http://127.0.0.1:5000/assets/index.c6214be6.js:35
    jg http://127.0.0.1:5000/assets/index.c6214be6.js:35
    ig http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Jg http://127.0.0.1:5000/assets/index.c6214be6.js:37
    Oh http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Ht http://127.0.0.1:5000/assets/index.c6214be6.js:4860
    wt http://127.0.0.1:5000/assets/index.c6214be6.js:5417
    Dt http://127.0.0.1:5000/assets/index.c6214be6.js:5417
    Rb http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Xb http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Yb http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Ze http://127.0.0.1:5000/assets/index.c6214be6.js:35
    se$1 http://127.0.0.1:5000/assets/index.c6214be6.js:35
    jd http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Jb http://127.0.0.1:5000/assets/index.c6214be6.js:39
    Nb http://127.0.0.1:5000/assets/index.c6214be6.js:35
    jd http://127.0.0.1:5000/assets/index.c6214be6.js:35
    yc http://127.0.0.1:5000/assets/index.c6214be6.js:35
    hd http://127.0.0.1:5000/assets/index.c6214be6.js:35
    unstable_runWithPriority http://127.0.0.1:5000/assets/index.c6214be6.js:24
    gg http://127.0.0.1:5000/assets/index.c6214be6.js:35
    Hb http://127.0.0.1:5000/assets/index.c6214be6.js:39
    gd http://127.0.0.1:5000/assets/index.c6214be6.js:35
    af http://127.0.0.1:5000/assets/index.c6214be6.js:35
    df http://127.0.0.1:5000/assets/index.c6214be6.js:35
    cf http://127.0.0.1:5000/assets/index.c6214be6.js:35
    cf http://127.0.0.1:5000/assets/index.c6214be6.js:35
    qk http://127.0.0.1:5000/assets/index.c6214be6.js:39
    sk http://127.0.0.1:5000/assets/index.c6214be6.js:39
    tk http://127.0.0.1:5000/assets/index.c6214be6.js:39
    render http://127.0.0.1:5000/assets/index.c6214be6.js:39
    G4 http://127.0.0.1:5000/assets/index.c6214be6.js:5529
    U4 http://127.0.0.1:5000/assets/index.c6214be6.js:1
    <anonymous> http://127.0.0.1:5000/assets/index.c6214be6.js:5529
index.c6214be6.js:5411:10804

what causes this?

mornec-ridhut commented 4 months ago

I was also having the same issue trying to setup Bridge 3.2.10. Though I was able to fix it, thanks in no small part to ~dinleb-rambep who pointed me to the right direction. I think the README is due for a little bit of an update since I have to scour the issue tracker for bits of info trying to get Bridge to run.

I got the build commands from here.

nvm install v16.18.0
nvm use v16.18.0
npm install -g truffle
export NODE_OPTIONS=--max-old-space-size=8192
export VITE_INFURA_ENDPOINT=[...]
export VITE_WALLET_CONNECT_PROJECT_ID=[...]
npm run release

This gave me a runnable .zip file that will actually load Bridge. But logging in with either the Master Ticket or Metamask gives me a "Unable to derive wallet from ticket" for the former and "{"code":7979,"data":{}}" for the latter. I was able to fix it by running a Python HTTPS webserver on localhost running at port 3000 with a self-signed cert. Here's the OpenSSL command and the Python script that I used to make it work:

openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes
import http.server
import ssl

server_address = ('localhost', 3000)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
                               server_side=True,
                               certfile="server.pem",
                               keyfile="key.pem",
                               ssl_version=ssl.PROTOCOL_TLS)
httpd.serve_forever()

Again, thanks to ~dinleb-rambep for the huge assist on getting this thing to work.