EvolutionAPI / evolution-api

Evolution API is an open-source WhatsApp integration API
https://evolution-api.com
Other
1.89k stars 1.03k forks source link

[BUG] - Erro ao realizar build na v2 com MYSQL - NVM #823

Open juniormelo26 opened 2 months ago

juniormelo26 commented 2 months ago

Welcome!

What did you do?

Ao tentar realizar o build seguindo a documentação de instalação via NVM.

What did you expect?

Esperava que o build fosse concluido para poder seguir com adocumentação de instalação.

What did you observe instead of what you expected?

evolution-api# npm run build

> evolution-api@2.1.0 build
> tsc --noEmit && tsup

src/api/integrations/channel/meta/whatsapp.business.service.ts:564:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

564                   path: ['id'],
                      ~~~~

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:414:13 - error TS2322: Type 'string[]' is not assignable to type 'string'.

414             path: ['id'],
                ~~~~

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1276:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1276                 path: ['id'],
                     ~~~~

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1374:20 - error TS2353: Object literal may only specify known properties, and 'labelId_instanceId' does not exist in type 'LabelWhereUniqueInput'.

1374           where: { labelId_instanceId: { instanceId: this.instanceId, labelId: label.id } },
                        ~~~~~~~~~~~~~~~~~~

  node_modules/.prisma/client/index.d.ts:12795:5
    12795     where: LabelWhereUniqueInput
              ~~~~~
    The expected type comes from property 'where' which is declared here on type '{ select?: LabelSelect<DefaultArgs>; include?: LabelInclude<DefaultArgs>; where: LabelWhereUniqueInput; }'

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1392:15 - error TS2353: Object literal may only specify known properties, and 'labelId_instanceId' does not exist in type 'LabelWhereUniqueInput'.

1392               labelId_instanceId: {
                   ~~~~~~~~~~~~~~~~~~

  node_modules/.prisma/client/index.d.ts:12769:5
    12769     where: LabelWhereUniqueInput
              ~~~~~
    The expected type comes from property 'where' which is declared here on type '{ select?: LabelSelect<DefaultArgs>; include?: LabelInclude<DefaultArgs>; where: LabelWhereUniqueInput; create: (Without<...> & LabelUncheckedCreateInput) | (Without<...> & LabelCreateInput); update: (Without<...> & LabelUncheckedUpdateInput) | (Without<...> & LabelUpdateInput); }'

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1357:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1357                 path: ['fromMe'],
                     ~~~~

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1392:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1392                   path: ['id'],
                       ~~~~

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1441:11 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1441           path: ['id'],
               ~~~~

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1460:11 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1460           path: ['id'],
               ~~~~

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1850:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1850                 path: ['id'],
                     ~~~~

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:2097:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

2097                   path: ['id'],
                       ~~~~

src/api/services/channel.service.ts:530:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

530           keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:531:11 - error TS2322: Type '{ key: { path: string[]; equals: true; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: true; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

531           keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:532:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

532           remoteJid ? { key: { path: ['remoteJid'], equals: remoteJid } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:533:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

533           keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:553:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

553           keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:554:11 - error TS2322: Type '{ key: { path: string[]; equals: true; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: true; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

554           keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:555:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

555           remoteJid ? { key: { path: ['remoteJid'], equals: remoteJid } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/api/services/channel.service.ts:556:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

556           keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 19 errors in 4 files.

Errors  Files
     1  src/api/integrations/channel/meta/whatsapp.business.service.ts:564
     4  src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:414
     6  src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1357
     8  src/api/services/channel.service.ts:530

Screenshots/Videos

No response

Which version of the API are you using?

2.1.0

What is your environment?

Linux

Other environment specifications

4 vcp e 4GB

If applicable, paste the log output

evolution-api# npm run build

evolution-api@2.1.0 build tsc --noEmit && tsup

src/api/integrations/channel/meta/whatsapp.business.service.ts:564:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

564 path: ['id'],


src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:414:13 - error TS2322: Type 'string[]' is not assignable to type 'string'.

414             path: ['id'],

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1276:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1276 path: ['id'],


src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1374:20 - error TS2353: Object literal may only specify known properties, and 'labelId_instanceId' does not exist in type 'LabelWhereUniqueInput'.

1374           where: { labelId_instanceId: { instanceId: this.instanceId, labelId: label.id } },

node_modules/.prisma/client/index.d.ts:12795:5 12795 where: LabelWhereUniqueInput

    The expected type comes from property 'where' which is declared here on type '{ select?: LabelSelect<DefaultArgs>; include?: LabelInclude<DefaultArgs>; where: LabelWhereUniqueInput; }'

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1392:15 - error TS2353: Object literal may only specify known properties, and 'labelId_instanceId' does not exist in type 'LabelWhereUniqueInput'.

1392               labelId_instanceId: {

node_modules/.prisma/client/index.d.ts:12769:5 12769 where: LabelWhereUniqueInput

    The expected type comes from property 'where' which is declared here on type '{ select?: LabelSelect<DefaultArgs>; include?: LabelInclude<DefaultArgs>; where: LabelWhereUniqueInput; create: (Without<...> & LabelUncheckedCreateInput) | (Without<...> & LabelCreateInput); update: (Without<...> & LabelUncheckedUpdateInput) | (Without<...> & LabelUpdateInput); }'

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1357:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1357                 path: ['fromMe'],

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1392:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1392 path: ['id'],


src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1441:11 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1441           path: ['id'],

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1460:11 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1460 path: ['id'],


src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1850:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1850                 path: ['id'],

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:2097:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

2097 path: ['id'],


src/api/services/channel.service.ts:530:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

530           keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},

src/api/services/channel.service.ts:531:11 - error TS2322: Type '{ key: { path: string[]; equals: true; }; } | {}' is not assignable to type 'MessageWhereInput'. Types of property 'key' are incompatible. Type '{ path: string[]; equals: true; }' is not assignable to type 'JsonFilter<"Message">'. Types of property 'path' are incompatible. Type 'string[]' is not assignable to type 'string'.

531 keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},


src/api/services/channel.service.ts:532:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

532           remoteJid ? { key: { path: ['remoteJid'], equals: remoteJid } } : {},

src/api/services/channel.service.ts:533:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'. Types of property 'key' are incompatible. Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'. Types of property 'path' are incompatible. Type 'string[]' is not assignable to type 'string'.

533 keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},


src/api/services/channel.service.ts:553:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

553           keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},

src/api/services/channel.service.ts:554:11 - error TS2322: Type '{ key: { path: string[]; equals: true; }; } | {}' is not assignable to type 'MessageWhereInput'. Types of property 'key' are incompatible. Type '{ path: string[]; equals: true; }' is not assignable to type 'JsonFilter<"Message">'. Types of property 'path' are incompatible. Type 'string[]' is not assignable to type 'string'.

554 keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},


src/api/services/channel.service.ts:555:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'.
  Types of property 'key' are incompatible.
    Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'.
      Types of property 'path' are incompatible.
        Type 'string[]' is not assignable to type 'string'.

555           remoteJid ? { key: { path: ['remoteJid'], equals: remoteJid } } : {},

src/api/services/channel.service.ts:556:11 - error TS2322: Type '{ key: { path: string[]; equals: string; }; } | {}' is not assignable to type 'MessageWhereInput'. Types of property 'key' are incompatible. Type '{ path: string[]; equals: string; }' is not assignable to type 'JsonFilter<"Message">'. Types of property 'path' are incompatible. Type 'string[]' is not assignable to type 'string'.

556 keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},


Found 19 errors in 4 files.

Errors  Files
     1  src/api/integrations/channel/meta/whatsapp.business.service.ts:564
     4  src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:414
     6  src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1357
     8  src/api/services/channel.service.ts:530

### Additional Notes

```
> evolution-api@2.1.0 build
> tsc --noEmit && tsup

src/api/integrations/channel/meta/whatsapp.business.service.ts:564:19 - error TS2322: Type 'string[]' is not assignable to type 'string'.

564                   path: ['id'],

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:414:13 - error TS2322: Type 'string[]' is not assignable to type 'string'.

414 path: ['id'],


src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1276:17 - error TS2322: Type 'string[]' is not assignable to type 'string'.

1276                 path: ['id'],

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1374:20 - error TS2353: Object literal may only specify known properties, and 'labelId_instanceId' does not exist in type 'LabelWhereUniqueInput'.

1374 where: { labelId_instanceId: { instanceId: this.instanceId, labelId: label.id } },


  node_modules/.prisma/client/index.d.ts:12795:5
    12795     where: LabelWhereUniqueInput
The expected type comes from property 'where' which is declared here on type '{ select?: LabelSelect<DefaultArgs>; include?: LabelInclude<DefaultArgs>; where: LabelWhereUniqueInput; }'

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:1392:15 - error TS2353: Object literal may only specify known properties, and 'labelId_instanceId' does not exist in type 'LabelWhereUniqueInput'.

1392 labelId_instanceId: {


  node_modules/.prisma/client/index.d.ts:12769:5
    12769     where: LabelWhereUniqueInput
The expected type comes from property 'where' which is declared here on type '{ select?: LabelSelect<DefaultArgs>; include?: LabelInclude<DefaultArgs>; where: LabelWhereUniqueInput; create: (Without<...> & LabelUncheckedCreateInput) | (Without<...> & LabelCreateInput); update: (Without<...> & LabelUncheckedUpdateInput) | (Without<...> & LabelUpdateInput); }'
juniormelo26 commented 2 months ago

Esse erro acontece apenas quando o banco é mysql

ciadavid commented 1 month ago

solution?

iagocotta commented 1 month ago

Estou tendo o mesmo problema com o mysql =/

Found 21 errors in 5 files.

Errors Files 1 src/api/integrations/channel/meta/whatsapp.business.service.ts:564 4 src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:415 6 src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts:1359 8 src/api/services/channel.service.ts:537 2 src/utils/onWhatsappCache.ts:62

dpaes commented 1 month ago

enquanto não funciona com mysql, tenta com postgres que não tem dado problema

juniormelo26 commented 1 month ago

solution?

Não cheguei a verificar os erros no fonte, só utilizei o postgres e deu certo.

juniormelo26 commented 1 month ago

enquanto não funciona com mysql, tenta com postgres que não tem dado problema

Top meu nobre, fiz isso, por enquanto não cheguei a verificar, só mudei para o postgres.

lopesfontana commented 1 month ago

Pessoal que está implementando migration, só está considerando o postgress, esquecendo de criar tbm para mysql

juniormelo26 commented 1 month ago

Praticamente abandonado essa parte do projeto.

dpaes commented 1 month ago

acabaram de mandar uma PR pra migration do mysql

juniormelo26 commented 1 month ago

o erro continua...