Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

240
Vistas
Error importing SendInBlue in my NodeJS app?

I am refactoring my Node app to use ES6 import modules instead of requiring in files.

I am unable to figure out how to make this work with my e-mail package SendInBlue because I get the error.

TypeError: Cannot read properties of undefined (reading 'ApiClient')

Before I was using "import { SibApiV3Sdk } from "sib-api-v3-sdk" but I got the error:

SyntaxError: Named export 'SibApiV3Sdk' not found. The requested module 'sib-api-v3-sdk' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'sib-api-v3-sdk';
const { SibApiV3Sdk } = pkg;

^ So this is why I am using the current import code below, which is not working either?

How can I get this to work?

CODE

import pkg from "sib-api-v3-sdk"
const { SibApiV3Sdk } = pkg"
const defaultClient = SibApiV3Sdk.ApiClient.instance
const apiKey = defaultClient.authentications["api-key"]
apiKey.apiKey = process.env.SEND_IN_BLUE_API_KEY
import secretCodeHtml from "../templates/secretCodeEmail.js"

const sendSecretCodeEmail = (text) => {
  var apiInstance = new SibApiV3Sdk.TransactionalEmailsApi()
  var sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail()
  sendSmtpEmail = {
    sender: { email: senderEmail },
    to: [
      {
        email: recipientEmail,
        name: recipientEmail,
      },
    ],
    subject: emailSubject,
    htmlContent: text,
  }
  apiInstance.sendTransacEmail(sendSmtpEmail)
}

export default sendSecretCodeEmail

ERROR

file:///Users/app/git/app-node-api/src/emails/create/sendSecretCodeEmail.js:4
const defaultClient = SibApiV3Sdk.ApiClient.instance
                                  ^
TypeError: Cannot read properties of undefined (reading 'ApiClient')
    at file:///Users/app/git/app-node-api/src/emails/create/sendSecretCodeEmail.js:4:35
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda