Whats the proper way to connect to web3

Im trying to get ethers in my website, but when following these stepes, its not working
https://docs.moralis.io/moralis-server/web3/web3


const serverUrl = "https://sbbrhtfyrpum.usemoralis.com:2053/server";
const appId = "appid";
Moralis.start({ serverUrl, appId });
const ethers = Moralis.web3Library
// Get a (ethers.js) web3Provider 
const web3Provider = Moralis.enableWeb3();
/** Add from here down */
async function login() {
  let user = Moralis.User.current();
  if (!user) {
   try {
      user = await Moralis.authenticate({ signingMessage: "Hello World!" })
      console.log(user)
      console.log(user.get('ethAddress'))
      stats()
   } catch(error) {
     console.log(error)
   }
  }
}

When I run this i get folowing error:
Uncaught (in promise) TypeError: signerOrProvider is null

where do you try to use that code? in a nodejs server, in a browser? do you have metamask connected?

what version of Moralis SDK are you using?