Back to All

Frontend API request CORS error

Hi,

I am using Nodit as my aptos testnet full-node API & indexer endpoint.
My indexer queries work as expected.
However, when the following line gets executed:

const response = await signAndSubmitTransaction(transaction);
const result = await aptos.waitForTransaction({
  transactionHash: response.hash,
});

I will get an error from the request: "AxiosError: Network Error".
Also, the network tab in Chrome specifies this request's status as a CORS error.

The request url is: "https://aptos-testnet.nodit.io/<API_KEY>/v1/transactions/by_hash/0x9558bed3fdca62e6a3c44f22f348bf890de8218a41a5f63379f0700a84867b2b".
When I paste the URL in Chrome, I can get the response as expected.

My Aptos config is as follows:

const config = new AptosConfig({
  fullnode: `https://aptos-testnet.nodit.io/${EnvVariables.APTOS_NODIT_KEY}/v1`,
  indexer: `https://aptos-testnet.nodit.io/${EnvVariables.APTOS_NODIT_KEY}/v1/graphql`,
});
const aptos = new Aptos(config);

I turned off all the console security tabs, including Domain Allowlist and Source IP.

Best,
Amos