Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

436
Views
TypeError: obj is not a constructor (error in js / node)

Note: I'm normally coding in Python, so I am completely new to javascript.

I'm trying to use the following repo: https://github.com/omerdn1/otter.ai-api

I used the setup code, but I replaced the import with the following instead: const OtterApi = require('otter.ai-api') because I was getting SyntaxError: Cannot use import statement outside a module.

However, now I'm getting the following error: TypeError: OtterApi is not a constructor. If I look at index.js in the repo, it does look like a constructor? First part of the code is:

class OtterApi {
  constructor(options = {}) {
    this.options = options;
    this.user = {};
    this.csrfToken = '';
  }

  init = async () => {
    await this.#login();
  };

The code I'm trying to run:

const OtterApi = require('otter.ai-api');

const otterApi = new OtterApi({
    email: 'email', // Your otter.ai email
    password: 'pw', // Your otter.ai password
});

async function main() {
    await otterApi.init() // Performs login
}

main();

I get the error when using new OtterApi(). I'm not sure how to resolve this.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to refer to the "default" export:

const OtterApi = require('otter.ai-api').default;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!