I'm getting ReferenceError: Buffer is not defined when trying to use near-api-js.
The relevant lines of code are:
export const near = new Near({
networkId,
keyStore: new keyStores.BrowserLocalStorageKeyStore(),
nodeUrl,
walletUrl,
headers: null,
});
export const walletConnection = new WalletConnection(near, appKeyPrefix);
walletConnection.requestSignIn({ // This line causes the problem
contractId,
methodNames: [],
});
My project is a fresh installation of Gatsby.
Any ideas what I'm missing?