Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

441
Visualizações
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 Respostas
Responde à pergunta

0

You need to refer to the "default" export:

const OtterApi = require('otter.ai-api').default;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda