getbrevo / brevo-node

A fully-featured JavaScript API client to interact with Brevo.
https://developers.brevo.com/
ISC License
62 stars 8 forks source link

TypeScript errors when deploying to Firebase Cloud Functions #32

Open julienlebren opened 5 months ago

julienlebren commented 5 months ago

This package is totally unusable because its code does not compile...

node_modules/@getbrevo/brevo/dist/api/accountApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/companiesApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/contactsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/conversationsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/couponsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/dealsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/domainsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/ecommerceApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/emailCampaignsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/eventsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/externalFeedsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/filesApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/inboundParsingApi.d.ts:3:8 - error TS1192: Module '"http"' has no default export.

3 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/masterAccountApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/notesApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/paymentsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/processApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/resellerApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/sendersApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/sMSCampaignsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/tasksApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/transactionalEmailsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/transactionalSMSApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/transactionalWhatsAppApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/userApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/webhooksApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/api/whatsAppCampaignsApi.d.ts:2:8 - error TS1192: Module '"http"' has no default export.

2 import http from 'http';
         ~~~~

node_modules/@getbrevo/brevo/dist/model/models.d.ts:3:8 - error TS1259: Module '"/Users/julienlebren/node_modules/@types/request/index"' can only be default-imported using the 'esModuleInterop' flag

3 import localVarRequest from 'request';
         ~~~~~~~~~~~~~~~

  node_modules/@types/request/index.d.ts:395:1
    395 export = request;
        ~~~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

Found 28 errors in 28 files.

Errors  Files
     1  node_modules/@getbrevo/brevo/dist/api/accountApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/companiesApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/contactsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/conversationsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/couponsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/dealsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/domainsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/ecommerceApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/emailCampaignsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/eventsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/externalFeedsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/filesApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/inboundParsingApi.d.ts:3
     1  node_modules/@getbrevo/brevo/dist/api/masterAccountApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/notesApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/paymentsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/processApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/resellerApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/sendersApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/sMSCampaignsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/tasksApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/transactionalEmailsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/transactionalSMSApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/transactionalWhatsAppApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/userApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/webhooksApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/api/whatsAppCampaignsApi.d.ts:2
     1  node_modules/@getbrevo/brevo/dist/model/models.d.ts:3

Error: functions predeploy error: Command terminated with non-zero exit code 2
TracKer commented 3 months ago

@julienlebren Did you find a solution to the issue?

julienlebren commented 2 months ago

I edited all the files manually and changed import * http from 'http'; to import * as http from 'http';

A shame that Brevo is not fixing this and released something completely bugged. And no reply from the team after 2 months... really not a serious company.

mr-jstraub commented 1 month ago

+1 same issue here

gmarizy commented 5 days ago

Adding "esModuleInterop": true, in compilerOptions of my tsconfig.json seems to solve the problem. But I don't know the consequences of this change.