2

folks, trying to connect to Pagoda via near-api-js

const CONTRACT_NAME = process.env.CONTRACT_NAME || 'mycontract.testnet'
const API_KEY = '06cffba5-e0c5-bla-bla-blablabla';
const keyStore = new keyStores.BrowserLocalStorageKeyStore();

My config looks like this:

   {
      networkId: 'testnet',
      nodeUrl: 'https://rpc.testnet.near.org/',
      keyStore,
      contractName: CONTRACT_NAME,
      walletUrl: 'https://wallet.testnet.near.org',
      helperUrl: 'https://helper.testnet.near.org',
      explorerUrl: 'https://explorer.testnet.near.org',
      headers: {
        'x-api-key': API_KEY,
        'Content-Type': 'application/json'
      },
    }

And getting this error, when I remove headers, everything works perfectly, but I can't connect to Pagoda :)

Access to fetch at 'https://rpc.testnet.near.org/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
kiskesis
  • 171
  • 1
  • 1
  • 9

0 Answers0