Is there something wrong with this NodeJS code?

I used the sample code (below) but I get an error “Error: FetchError: Not Found” with the code below, but when I try the “shell code” (curl --request GET --url 'https://dollarvigilante.api-us1.com/api/3/contacts?search=null&segmentid=null&status=-1&orders%5Bid%5D=ASC&orders%5Bemail$5D=ASC' --header 'Api-Token: OURAPIKEY' --header 'accept: application/json') it works fine.

Here’s the code that says “Not Found”:

const port = 3222; // Choose a port that's not already in use

import activecampaign from '@api/activecampaign';

activecampaign.auth(OURAPIKEY);

async function processRequest(req) {
  try {
    const alac = await activecampaign.listAllContacts({
      search: 'null',
      segmentid: 'null',
      status: '-1',
      'filters[created_after]': '2025-05-01',
      'orders[id]': 'ASC',
      'orders[email]': 'ASC'
    });
  } catch(e) {
    return "Caught Error: " + e.toString();
  }
  return alac;
}

async function makeHTML(req) {
  // Your function to generate the HTML content
  const page = await processRequest(req);
  return `
    <!DOCTYPE html>
    <html>
    <head>
      <title>Dynamic Page from NodeJS</title>
    </head>
    <body>
      <h1>Hello from NodeJS!</h1>
      <p>This content was dynamically generated.</p>
      ${page}
    </body>
    </html>
  `;

I’m looking for ideas why it says “not found” for the Javascript, but provides results with curl.

The problem is that this code relies on @api/activecampaign to provide the URL to the API, but that URL depends on your account name. This is similar to the code provided by ActiveCampaign at https://developers.activecampaign.com/reference/list-all-contacts but if you specify anything for “youraccountname”, you will see that the code changes and shows you where you need to use both your API key and your account name.