Unable to connect to Enterprise App Search via Node.js

Hi, I am trying to connect to Enterprise App Search via node.js. I followed the below github code
https://github.com/elastic/app-search-node

but this is the error I am getting while connecting to the enterprise engine I have.

    Error: Unauthorized
    at Request._callback (D:\Web and App stuffs\Node.js\elastic-search\node_modules\@elastic\app-search-node\lib\client.js:95:26)   
    at Request.self.callback (D:\Web and App stuffs\Node.js\elastic-search\node_modules\request\request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (D:\Web and App stuffs\Node.js\elastic-search\node_modules\request\request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (D:\Web and App stuffs\Node.js\elastic-search\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errorMessages: [
    {
      root_cause: [Array],
      type: 'security_exception',
      reason: 'missing authentication credentials for REST request [/engines/test-engine/documents]',
      header: [Object]
    }
  ]
}

Can anyone let me know how do I add my credentials ? This is my code

const AppSearchClient = require('@elastic/app-search-node');
const apiKey = 'API_KEY'
const baseUrlFn = () => 'Here I am using my Enterprise App Search Endpoint API'

const client = new AppSearchClient(undefined, apiKey, baseUrlFn)

//A dummy data to add
let data = {
    "id": "some123",
    "title": "random",
    "description": "Split into the separate Rincon Mountain and Tucson Mountain districts, this park is evidence that the dry Sonoran Desert is still home to a great variety of life spanning six biotic communities. Beyond the namesake giant saguaro cacti, there are barrel cacti, chollas, and prickly pears, as well as lesser long-nosed bats, spotted owls, and javelinas.",
    "nps_link": "https://www.nps.gov/sagu/index.htm",
    "states": [
        "Arizona"
    ],
    "visitors": 838456,
    "world_heritage_site": false,
    "location": "32.20,-109.5",
    "acres": 9215.72,
    "square_km": 2271.2,
    "date_established": "1997-10-14T05:00:00Z"
}
    client
        .indexDocuments('test-engine', data)
        .then(response => {
            console.log(response)
            return res.status(200).json({
                message: response.body
            })
        }).catch(error => console.log(error))

Hi @Shoto_todoroki, can you please share with me the versions of App Search and Elasticsearch you are running?