Walletconnect authentication not working

Hi,

Seems walletconnect authentication API is not working. It was working fine few days back, but suddenly it seems to be broken now.

async function loginWalletConnect() {
    let user = Moralis.User.current();
    if (!user) {
        await Moralis.Web3.authenticate({ provider: "walletconnect", signingMessage: "Signing in to SHIBIC" });
    }
}

libraries included:

<script src="https://unpkg.com/moralis/dist/moralis.js"></script>
<script src="https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.7.0/web3-provider.min.js"></script>

Error I’m getting:

Uncaught (in promise) Error: Cannot enable WalletConnect: dependency "@walletconnect/web3-provider" is missing
    at WalletConnectWeb3Connector.<anonymous> (moralis.js:27670:23)
    at tryCatch (moralis.js:72589:40)
    at Generator.invoke [as _invoke] (moralis.js:72820:22)
    at Generator.next (moralis.js:72645:21)
    at asyncGeneratorStep (moralis.js:29235:24)
    at _next (moralis.js:29257:9)

Hey Moralis.Web3.authenticate is a legacy syntax that you must change to Moralis.authenticate :raised_hands:

Also since you’re using the latest by default, we do have breaking changes in our latest SDK so check this guide out for migrating to it Moralis JS SDK v1.0 (migration to Ethers.js)

Tested with this new method, still getting the same error:

async function loginWalletConnect() {
    let user = Moralis.User.current();
    if (!user) {
        await Moralis.authenticate({ provider: "walletconnect", signingMessage: "Signing in to SHIBIC" });
    }
}

Meanwhile I will try with new SDK, but for the time being, can you help resolve the above issue.

Got it working, I had to change the moralis lib as well.

<script src="https://unpkg.com/[email protected]/dist/moralis.js"></script>

1 Like

I was trying to use the latest sdk, but this walletconnect feature is not working.

<script src="https://unpkg.com/[email protected]/dist/moralis.js"></script>

I believe this feature should be inherently avaiable in this new sdk as well. Please clarify how to implement this.

Yeah I remember it was mentioned there’s a bit of bug in the latest one, you should revert to 0.0.184 to use walletconnect at the moment, but a bug fixes is coming :raised_hands:

okay, can I get an update once that bug is fixed.
I will keep watching this post for the update.

sure thing for sure :raised_hands:

1 Like

Hey @vikasg, btw just checked on this and looks like walletconnect works fine on v1.0.3, can you copy any error from the console if there’s any?

Hi @YosephKS

Here is the code:

<script src="https://unpkg.com/[email protected]/dist/moralis.js"></script>


async function loginWalletConnect() {
    let user = Moralis.User.current();
    if (!user) {
        await Moralis.authenticate({ provider: "walletconnect", signingMessage: "Signing in to SHIBIC" });
    }
}

and the error:

Uncaught (in promise) Error: Cannot enable WalletConnect: dependency "@walletconnect/web3-provider" is missing
    at WalletConnectWeb3Connector.<anonymous> (moralis.js:27670:23)
    at tryCatch (moralis.js:72589:40)
    at Generator.invoke [as _invoke] (moralis.js:72820:22)
    at Generator.next (moralis.js:72645:21)
    at asyncGeneratorStep (moralis.js:29235:24)
    at _next (moralis.js:29257:9)

you just haven’t imported walletconnect library to your project, add

<script src="https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.6.2/web3-provider.min.js"></script>

in your HTML file :raised_hands:

Sorry, I forgot to mention earlier, the walletconnect lib is already included, and I am using the new version 1.7.0.

<script src="https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.7.0/web3-provider.min.js"></script>

Tried with your version as well (1.6.2), but still the same issue.

hang on how about let’s use the unpkg version, let me write it down a moment

can you share a complete minimal code that doesn’t work for you?

<script src="unpkg.com/@walletconnect/[email protected]"></script>

Also having the Same problem, thats why i canged my livestuff back to old Moralis 0.0.184. But wanna update this soon. So far locally everything is working, beside of the walletconnect … and as my community is mostly using walletconnect they would kill me if this is not available haha.

Tried your solution @YosephKS but still the same error. :frowning:

still does not work, same error:

moralis.js:27670 Uncaught (in promise) Error: Cannot enable WalletConnect: dependency "@walletconnect/web3-provider" is missing
    at WalletConnectWeb3Connector.<anonymous> (moralis.js:27670:23)
    at tryCatch (moralis.js:72589:40)
    at Generator.invoke [as _invoke] (moralis.js:72820:22)
    at Generator.next (moralis.js:72645:21)
    at asyncGeneratorStep (moralis.js:29235:24)
    at _next (moralis.js:29257:9)

Hi @cryptokid, this is the complete minimal code which is not working:

<script src="https://unpkg.com/[email protected]/dist/moralis.js"></script>
<script src="https://unpkg.com/@walletconnect/[email protected]"></script>


async function loginWalletConnect() {
    let user = Moralis.User.current();
    if (!user) {
        await Moralis.authenticate({ provider: "walletconnect", signingMessage: "Signing in to SHIBIC" });
    }
}

@Erno any input on this? seems like the WC import on version >1.0.0 is not working or something missing :thinking:

Hi @vikasg !

Try it:

<script src="https://unpkg.com/[email protected]/dist/moralis.js"></script>
<script src="https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.6.6/web3-provider.min.js"></script>

Works for me right now.