Search code examples
typescriptnext.jsweb3-reactthirdweb

how to solve websocket.onclose error in thirdweb?


I am new to next.js,I a, developing a website based on web3 so I have to use thirdweb.

First I ran this command to add thirdweb to my project :

yarn add @thirdweb-dev/react @thirdweb-dev/sdk ethers

then I changed the app.tsx to these codes :

import '../styles/globals.css'
import type { AppProps } from 'next/app'

import { ChainId, ThirdwebProvider } from "@thirdweb-dev/react"

function MyApp({ Component, pageProps }: AppProps) {

  return (

<ThirdwebProvider desiredChainId={ChainId.Rinkeby}>

  <Component {...pageProps} />

</ThirdwebProvider>
  )

}

export default MyApp

finally it errors:

Call Stack
webSocket.onclose node_modules@coinbase\wallet-sdk\dist\connection\RxWebSocket.js (50:0)

could you help me with it please?


Solution

  • Not 100% sure exactly the issue based on this post alone, but you can get started with the recommended setup for thirdweb + Next.js with the CLI:

    npx thirdweb create --app --next
    

    I think your issue might be related to the versions of the SDK you're using - could you provide those here for us?