trezor / trezor-suite

Trezor Suite Monorepo
https://trezor.io/trezor-suite
Other
737 stars 256 forks source link

connect manifest not set err #8475

Open mroz22 opened 1 year ago

mroz22 commented 1 year ago

if custom connectSrc is provided and this endpoint is not available, TrezorConnect.init returns

{"success":false,"payload":{"error":"Manifest not set. Read more at https://github.com/trezor/trezor-suite/blob/develop/docs/packages/connect/index.md","code":"Init_ManifestMissing"}}

It should return a better error.

Example

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>@trezor/connect example</title>
    </head>
    <body>
        <script type="text/javascript" src="http://connect.trezor.io/9/trezor-connect.js"></script>
        <script type="text/javascript">
            window.TrezorConnect.init({
                lazyLoad: false,
                popup: false,
                connectSrc: 'http://localhost:8088/',      <----- I forgot to spin up this
                manifest: {
                    email: 'developer@xyz.com',
                    appUrl: 'http://your.application.com',
                },
            });

            getAddress = function () {
                window.TrezorConnect.getAddress({
                    // showOnTrezor: true,
                    path: "m/49'/0'/0'/0/0",
                    coin: 'btc',
                }).then(res => {
                    console.info('->', res);
                    document.getElementById('result').innerText = JSON.stringify(res);
                });
            };
        </script>

        <button onclick="getAddress()">Get address</button>

        <div id="result"></div>
    </body>
</html>
sime commented 1 year ago

Related? https://github.com/MetaMask/metamask-extension/issues/10359

sime commented 1 year ago

I was able to trigger this error with a fresh installation of MetaMask and pairing it with a Trezor immediately. After restarting the browser, the pairing issue no longer occurs.