evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

v2.2.3 - Invalid `this.cache.delete()` invocation - Argument `path`: Invalid value provided. Expected String, provided (String).

Open rafwell opened this issue 11 months ago • 7 comments

Welcome!

  • [x] Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Pessoal, estou com esse erro no log, já busquei formas de resolver mas não consegui. Ele acontece o tempo inteiro, fica difícil até de ver o log com tantos erros repetidos. Porém, tudo que tentei usar até agora funcionou. Estou com os seguintes parametros no meu env

DATABASE_SAVE_DATA_INSTANCE=true
DATABASE_SAVE_DATA_NEW_MESSAGE=false
DATABASE_SAVE_MESSAGE_UPDATE=false
DATABASE_SAVE_DATA_CONTACTS=false
DATABASE_SAVE_DATA_CHATS=false
DATABASE_SAVE_DATA_LABELS=false
DATABASE_SAVE_DATA_HISTORIC=false
DATABASE_SAVE_IS_ON_WHATSAPP=true
DATABASE_SAVE_IS_ON_WHATSAPP_DAYS=7
DATABASE_DELETE_MESSAGE=false

What did you expect?

Esperava entrar no log e ver somente outros alertas ou erros

What did you observe instead of what you expected?

Muitos erros repetidos

Screenshots/Videos

No response

Which version of the API are you using?

v2.2.0

What is your environment?

Docker

Other environment specifications

No response

If applicable, paste the log output

evolution_api    | [Evolution API]    v2.2.0  163   -  Mon Jan 20 2025 15:01:23     ERROR   [unhandledRejection]  [object]   
evolution_api    | PrismaClientValidationError: 
evolution_api    | Invalid `this.cache.delete()` invocation in
evolution_api    | /evolution/dist/main.js:250:24701
evolution_api    | 
evolution_api    |   247 `),r.url&&(n+=`URL:${r.url}
evolution_api    |   248 `),r.wuid||(r.wuid=this.createJid(r.phoneNumber)),n+=`item1.TEL;waid=${r.wuid}:${r.phoneNumber}
evolution_api    |   249 item1.X-ABLabel:Celular
evolution_api    | → 250 END:VCARD`,n};return e.contact.length===1?t.contact={displayName:e.contact[0].fullName,vcard:s(e.contact[0])}:t.contactsArrayMessage={displayName:`${e.contact.length} contacts`,contacts:e.contact.map(r=>({displayName:r.fullName,vcard:s(r)}))},await this.sendMessageWithTyping(e.number,{contacts:e.contact.map(r=>({name:{formatted_name:r.fullName,first_name:r.fullName},phones:[{phone:r.phoneNumber}],urls:[{url:r.url}],emails:[{email:r.email}],org:{company:r.organization}})),message:t},{delay:e?.delay,presence:"composing",quoted:e?.quoted,linkPreview:e?.linkPreview,mentionsEveryOne:e?.mentionsEveryOne,mentioned:e?.mentioned})}async reactionMessage(e){return await this.sendMessageWithTyping(e.key.remoteJid,{reactionMessage:{key:e.key,text:e.reaction}})}async getBase64FromMediaMessage(e){try{let t=e.message,s=t.messageType.includes("Message")?t.messageType:t.messageType+"Message",r=t.message[s];return{mediaType:t.messageType,fileName:r?.fileName,caption:r?.caption,size:{fileLength:r?.fileLength,height:r?.fileLength,width:r?.width},mimetype:r?.mime_type,base64:t.message.base64}}catch(t){throw this.logger.error(t),new y(t.toString())}}async deleteMessage(){throw new y("Method not available on WhatsApp Business API")}async mediaSticker(){throw new y("Method not available on WhatsApp Business API")}async pollMessage(){throw new y("Method not available on WhatsApp Business API")}async statusMessage(){throw new y("Method not available on WhatsApp Business API")}async reloadConnection(){throw new y("Method not available on WhatsApp Business API")}async whatsappNumber(){throw new y("Method not available on WhatsApp Business API")}async markMessageAsRead(){throw new y("Method not available on WhatsApp Business API")}async archiveChat(){throw new y("Method not available on WhatsApp Business API")}async markChatUnread(){throw new y("Method not available on WhatsApp Business API")}async fetchProfile(){throw new y("Method not available on WhatsApp Business API")}async offerCall(){throw new y("Method not available on WhatsApp Business API")}async sendPresence(){throw new y("Method not available on WhatsApp Business API")}async setPresence(){throw new y("Method not available on WhatsApp Business API")}async fetchPrivacySettings(){throw new y("Method not available on WhatsApp Business API")}async updatePrivacySettings(){throw new y("Method not available on WhatsApp Business API")}async fetchBusinessProfile(){throw new y("Method not available on WhatsApp Business API")}async updateProfileName(){throw new y("Method not available on WhatsApp Business API")}async updateProfileStatus(){throw new y("Method not available on WhatsApp Business API")}async updateProfilePicture(){throw new y("Method not available on WhatsApp Business API")}async removeProfilePicture(){throw new y("Method not available on WhatsApp Business API")}async blockUser(){throw new y("Method not available on WhatsApp Business API")}async updateMessage(){throw new y("Method not available on WhatsApp Business API")}async createGroup(){throw new y("Method not available on WhatsApp Business API")}async updateGroupPicture(){throw new y("Method not available on WhatsApp Business API")}async updateGroupSubject(){throw new y("Method not available on WhatsApp Business API")}async updateGroupDescription(){throw new y("Method not available on WhatsApp Business API")}async findGroup(){throw new y("Method not available on WhatsApp Business API")}async fetchAllGroups(){throw new y("Method not available on WhatsApp Business API")}async inviteCode(){throw new y("Method not available on WhatsApp Business API")}async inviteInfo(){throw new y("Method not available on WhatsApp Business API")}async sendInvite(){throw new y("Method not available on WhatsApp Business API")}async acceptInviteCode(){throw new y("Method not available on WhatsApp Business API")}async revokeInviteCode(){throw new y("Method not available on WhatsApp Business API")}async findParticipants(){throw new y("Method not available on WhatsApp Business API")}async updateGParticipant(){throw new y("Method not available on WhatsApp Business API")}async updateGSetting(){throw new y("Method not available on WhatsApp Business API")}async toggleEphemeral(){throw new y("Method not available on WhatsApp Business API")}async leaveGroup(){throw new y("Method not available on WhatsApp Business API")}async fetchLabels(){throw new y("Method not available on WhatsApp Business API")}async handleLabel(){throw new y("Method not available on WhatsApp Business API")}async receiveMobileCode(){throw new y("Method not available on WhatsApp Business API")}async fakeCall(){throw new y("Method not available on WhatsApp Business API")}};var rt=class{constructor(i,e,t,s){this.jid=i;this.exists=e;this.number=t;this.name=s}},ls=class{},us=class{},Mt=class{};var ds=class{},gs=class{},ot=class{};var ms=class{};var hs=class{},ys=class{},fs=class{},ws=class{};var jn=class{},bs=class extends jn{},Ss=class extends bs{},Es=class extends bs{},Is=class{};var Kn=require("baileys"),Re=class{constructor(i){this.cache=i;this.logger=new T("CacheService");i?this.logger.verbose(`cacheservice created using cache engine: ${i.constructor?.name}`):this.logger.verbose("cacheservice disabled")}async get(i){if(this.cache)return this.cache.get(i)}async hGet(i,e){if(!this.cache)return null;try{let t=await this.cache.hGet(i,e);return t?JSON.parse(t,Kn.BufferJSON.reviver):null}catch(t){return this.logger.error(t),null}}async set(i,e,t){this.cache&&this.cache.set(i,e,t)}async hSet(i,e,t){if(this.cache)try{let s=JSON.stringify(t,Kn.BufferJSON.replacer);await this.cache.hSet(i,e,s)}catch(s){this.logger.error(s)}}async has(i){if(this.cache)return this.cache.has(i)}async delete(i){if(this.cache)return this.cache.delete({
evolution_api    |         where: {
evolution_api    |           instanceId: "92503952-3e5e-45f1-9000-8916a8eb3797",
evolution_api    |           key: {
evolution_api    |             path: [
evolution_api    |               "id"
evolution_api    |             ],
evolution_api    |             ~~~~~~
evolution_api    |             equals: "3EB06CDC7D821683111042B00DCAA86BFEFB69D7"
evolution_api    |           }
evolution_api    |         }
evolution_api    |       })
evolution_api    | 
evolution_api    | Argument `path`: Invalid value provided. Expected String, provided (String).
evolution_api    |     at Dn (/evolution/node_modules/@prisma/client/runtime/library.js:114:8082)
evolution_api    |     at Mn.handleRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7396)
evolution_api    |     at Mn.handleAndLogRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7061)
evolution_api    |     at Mn.request (/evolution/node_modules/@prisma/client/runtime/library.js:121:6745)
evolution_api    |     at async l (/evolution/node_modules/@prisma/client/runtime/library.js:130:9633)
evolution_api    |     at async messages.update (/evolution/dist/main.js:250:24665) {
evolution_api    |   clientVersion: '5.21.1'
evolution_api    | } 
evolution_api    | 
e

Additional Notes

No response

rafwell avatar Jan 20 '25 18:01 rafwell

Estou recebendo a mesma mensagem. Se repete muito no log.

Não sei se tem relação ou não, mas também aparece repetidamente isso:

{"level":50, "time":1738245582466, "pid":163, "hostname": "b1720bcalbia", "key": {"remotelid": "[email protected]", "fromMe": false, "id": "xxxxxxxxxxxxx", "participant":"xxxxxxxxxx:7585.whatsapp.net"), "err":{"type": "Erroг", "message": "Received message with old counter: 60591, 32498", "stack": "Error: Received message with old counter: 60591, 32498\n at GroupCipher.getSen derkey (/evolution/node_modules/baileys/WASignalGroup/group_cipher.js:79:13) \n at. [email protected]::xxxxxxxxxxxxx::75 [as amitable] (/evolution/node_modules/baileys/WASignalGroup/group_cip her.js:58:30)\n at process.processTicksAndRejections (node:internal/process/toak queues:95:5)\n at async asyncQueueExecutor (/evolution/node modules/baileys/WASignalGroup/queue job.js:20:29)"}

"mag": "failed to decrypt message")

O erro acontecia na v.2.2.0, fiz a atualização para a v.2.2.1 e continua a mesma coisa.

htsnet avatar Jan 30 '25 14:01 htsnet

problema semelhante aqui. eventualmente, ao enviar mensagem via chatwoot, a mesma é marcada com erro e retorna a mensagem abaixo :

Invalid this.cache.delete() invocation in
/evolution/dist/main.js:250:6793

247 ),r.url&&(n+=URL:${r.url}
248 ),r.wuid||(r.wuid=this.createJid(r.phoneNumber)),n+=item1.TEL;waid=${r.wuid}:${r.phoneNumber}
249 item1.X-ABLabel:Celular
→ 250 END:VCARD,n};return e.contact.length===1?t.contact={displayName:e.contact[0].fullName,vcard:s(e.contact[0])}:t.contactsArrayMessage={displayName:${e.contact.length} contacts,contacts:e.contact.map(r=>({displayName:r.fullName,vcard:s(r)}))},await this.sendMessageWithTyping(e.number,{contacts:e.contact.map(r=>({name:{formatted_name:r.fullName,first_name:r.fullName},phones:[{phone:r.phoneNumber}],urls:[{url:r.url}],emails:[{email:r.email}],org:{company:r.organization}})),message:t},{delay:e?.delay,presence:"composing",quoted:e?.quoted,linkPreview:e?.linkPreview,mentionsEveryOne:e?.mentionsEveryOne,mentioned:e?.mentioned})}async reactionMessage(e){return await this.sendMessageWithTyping(e.key.remoteJid,{reactionMessage:{key:e.key,text:e.reaction}})}async getBase64FromMediaMessage(e){try{let t=e.message,s=t.messageType.includes("Message")?t.messageType:t.messageType+"Message",r=t.message[s];return{mediaType:t.messageType,fileName:r?.fileName,caption:r?.caption,size:{fileLength:r?.fileLength,height:r?.fileLength,width:r?.width},mimetype:r?.mime_type,base64:t.message.base64}}catch(t){throw this.logger.error(t),new y(t.toString())}}async deleteMessage(){throw new y("Method not available on WhatsApp Business API")}async mediaSticker(){throw new y("Method not available on WhatsApp Business API")}async pollMessage(){throw new y("Method not available on WhatsApp Business API")}async statusMessage(){throw new y("Method not available on WhatsApp Business API")}async reloadConnection(){throw new y("Method not available on WhatsApp Business API")}async whatsappNumber(){throw new y("Method not available on WhatsApp Business API")}async markMessageAsRead(){throw new y("Method not available on WhatsApp Business API")}async archiveChat(){throw new y("Method not available on WhatsApp Business API")}async markChatUnread(){throw new y("Method not available on WhatsApp Business API")}async fetchProfile(){throw new y("Method not available on WhatsApp Business API")}async offerCall(){throw new y("Method not available on WhatsApp Business API")}async sendPresence(){throw new y("Method not available on WhatsApp Business API")}async setPresence(){throw new y("Method not available on WhatsApp Business API")}async fetchPrivacySettings(){throw new y("Method not available on WhatsApp Business API")}async updatePrivacySettings(){throw new y("Method not available on WhatsApp Business API")}async fetchBusinessProfile(){throw new y("Method not available on WhatsApp Business API")}async updateProfileName(){throw new y("Method not available on WhatsApp Business API")}async updateProfileStatus(){throw new y("Method not available on WhatsApp Business API")}async updateProfilePicture(){throw new y("Method not available on WhatsApp Business API")}async removeProfilePicture(){throw new y("Method not available on WhatsApp Business API")}async blockUser(){throw new y("Method not available on WhatsApp Business API")}async updateMessage(){throw new y("Method not available on WhatsApp Business API")}async createGroup(){throw new y("Method not available on WhatsApp Business API")}async updateGroupPicture(){throw new y("Method not available on WhatsApp Business API")}async updateGroupSubject(){throw new y("Method not available on WhatsApp Business API")}async updateGroupDescription(){throw new y("Method not available on WhatsApp Business API")}async findGroup(){throw new y("Method not available on WhatsApp Business API")}async fetchAllGroups(){throw new y("Method not available on WhatsApp Business API")}async inviteCode(){throw new y("Method not available on WhatsApp Business API")}async inviteInfo(){throw new y("Method not available on WhatsApp Business API")}async sendInvite(){throw new y("Method not available on WhatsApp Business API")}async acceptInviteCode(){throw new y("Method not available on WhatsApp Business API")}async revokeInviteCode(){throw new y("Method not available on WhatsApp Business API")}async findParticipants(){throw new y("Method not available on WhatsApp Business API")}async updateGParticipant(){throw new y("Method not available on WhatsApp Business API")}async updateGSetting(){throw new y("Method not available on WhatsApp Business API")}async toggleEphemeral(){throw new y("Method not available on WhatsApp Business API")}async leaveGroup(){throw new y("Method not available on WhatsApp Business API")}async fetchLabels(){throw new y("Method not available on WhatsApp Business API")}async handleLabel(){throw new y("Method not available on WhatsApp Business API")}async receiveMobileCode(){throw new y("Method not available on WhatsApp Business API")}async fakeCall(){throw new y("Method not available on WhatsApp Business API")}};var rt=class{constructor(i,e,t,s){this.jid=i;this.exists=e;this.number=t;this.name=s}},ls=class{},us=class{},Mt=class{};var ds=class{},gs=class{},ot=class{};var ms=class{};var hs=class{},ys=class{},fs=class{},ws=class{};var jn=class{},bs=class extends jn{},Ss=class extends bs{},Es=class extends bs{},Is=class{};var Kn=require("baileys"),Re=class{constructor(i){this.cache=i;this.logger=new T("CacheService");i?this.logger.verbose(cacheservice created using cache engine: ${i.constructor?.name}`):this.logger.verbose(“cacheservice disabled”)}async get(i){if(this.cache)return this.cache.get(i)}async hGet(i,e){if(!this.cache)return null;try{let t=await this.cache.hGet(i,e);return t?JSON.parse(t,Kn.BufferJSON.reviver):null}catch(t){return this.logger.error(t),null}}async set(i,e,t){this.cache&&this.cache.set(i,e,t)}async hSet(i,e,t){if(this.cache)try{let s=JSON.stringify(t,Kn.BufferJSON.replacer);await this.cache.hSet(i,e,s)}catch(s){this.logger.error(s)}}async has(i){if(this.cache)return this.cache.has(i)}async delete(i){if(this.cache)return this.cache.delete(
Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 3)```

sosnoski avatar Jan 30 '25 22:01 sosnoski

Passando pra avisar que este erro persiste na v2.2.3

evolution_api    | [Evolution API]    v2.2.3  163   -  Fri Feb 07 2025 10:31:01     ERROR   [unhandledRejection]  [object]   
evolution_api    | PrismaClientValidationError: 
evolution_api    | Invalid `this.cache.delete()` invocation in
evolution_api    | /evolution/dist/main.js:230:28427
evolution_api    | 
evolution_api    |   227 `),o.url&&(n+=`URL:${o.url}
evolution_api    |   228 `),o.wuid||(o.wuid=Y(o.phoneNumber)),n+=`item1.TEL;waid=${o.wuid}:${o.phoneNumber}
evolution_api    |   229 item1.X-ABLabel:Celular
evolution_api    | → 230 END:VCARD`,n};return e.contact.length===1?t.contact={displayName:e.contact[0].fullName,vcard:s(e.contact[0])}:t.contactsArrayMessage={displayName:`${e.contact.length} contacts`,contacts:e.contact.map(o=>({displayName:o.fullName,vcard:s(o)}))},await this.sendMessageWithTyping(e.number,{contacts:e.contact.map(o=>({name:{formatted_name:o.fullName,first_name:o.fullName},phones:[{phone:o.phoneNumber}],urls:[{url:o.url}],emails:[{email:o.email}],org:{company:o.organization}})),message:t},{delay:e?.delay,presence:"composing",quoted:e?.quoted,linkPreview:e?.linkPreview,mentionsEveryOne:e?.mentionsEveryOne,mentioned:e?.mentioned})}async reactionMessage(e){return await this.sendMessageWithTyping(e.key.remoteJid,{reactionMessage:{key:e.key,text:e.reaction}})}async getBase64FromMediaMessage(e){try{let t=e.message,s=t.messageType.includes("Message")?t.messageType:t.messageType+"Message",o=t.message[s];return{mediaType:t.messageType,fileName:o?.fileName,caption:o?.caption,size:{fileLength:o?.fileLength,height:o?.fileLength,width:o?.width},mimetype:o?.mime_type,base64:t.message.base64}}catch(t){throw this.logger.error(t),new f(t.toString())}}async deleteMessage(){throw new f("Method not available on WhatsApp Business API")}async mediaSticker(){throw new f("Method not available on WhatsApp Business API")}async pollMessage(){throw new f("Method not available on WhatsApp Business API")}async statusMessage(){throw new f("Method not available on WhatsApp Business API")}async reloadConnection(){throw new f("Method not available on WhatsApp Business API")}async whatsappNumber(){throw new f("Method not available on WhatsApp Business API")}async markMessageAsRead(){throw new f("Method not available on WhatsApp Business API")}async archiveChat(){throw new f("Method not available on WhatsApp Business API")}async markChatUnread(){throw new f("Method not available on WhatsApp Business API")}async fetchProfile(){throw new f("Method not available on WhatsApp Business API")}async offerCall(){throw new f("Method not available on WhatsApp Business API")}async sendPresence(){throw new f("Method not available on WhatsApp Business API")}async setPresence(){throw new f("Method not available on WhatsApp Business API")}async fetchPrivacySettings(){throw new f("Method not available on WhatsApp Business API")}async updatePrivacySettings(){throw new f("Method not available on WhatsApp Business API")}async fetchBusinessProfile(){throw new f("Method not available on WhatsApp Business API")}async updateProfileName(){throw new f("Method not available on WhatsApp Business API")}async updateProfileStatus(){throw new f("Method not available on WhatsApp Business API")}async updateProfilePicture(){throw new f("Method not available on WhatsApp Business API")}async removeProfilePicture(){throw new f("Method not available on WhatsApp Business API")}async blockUser(){throw new f("Method not available on WhatsApp Business API")}async updateMessage(){throw new f("Method not available on WhatsApp Business API")}async createGroup(){throw new f("Method not available on WhatsApp Business API")}async updateGroupPicture(){throw new f("Method not available on WhatsApp Business API")}async updateGroupSubject(){throw new f("Method not available on WhatsApp Business API")}async updateGroupDescription(){throw new f("Method not available on WhatsApp Business API")}async findGroup(){throw new f("Method not available on WhatsApp Business API")}async fetchAllGroups(){throw new f("Method not available on WhatsApp Business API")}async inviteCode(){throw new f("Method not available on WhatsApp Business API")}async inviteInfo(){throw new f("Method not available on WhatsApp Business API")}async sendInvite(){throw new f("Method not available on WhatsApp Business API")}async acceptInviteCode(){throw new f("Method not available on WhatsApp Business API")}async revokeInviteCode(){throw new f("Method not available on WhatsApp Business API")}async findParticipants(){throw new f("Method not available on WhatsApp Business API")}async updateGParticipant(){throw new f("Method not available on WhatsApp Business API")}async updateGSetting(){throw new f("Method not available on WhatsApp Business API")}async toggleEphemeral(){throw new f("Method not available on WhatsApp Business API")}async leaveGroup(){throw new f("Method not available on WhatsApp Business API")}async fetchLabels(){throw new f("Method not available on WhatsApp Business API")}async handleLabel(){throw new f("Method not available on WhatsApp Business API")}async receiveMobileCode(){throw new f("Method not available on WhatsApp Business API")}async fakeCall(){throw new f("Method not available on WhatsApp Business API")}};var ct=class{constructor(i,e,t,s){this.jid=i;this.exists=e;this.number=t;this.name=s}},us=class{},ds=class{},Ct=class{};var gs=class{},ms=class{},pt=class{};var hs=class{};var fs=class{},ys=class{},ws=class{},bs=class{};var jn=class{},Ss=class extends jn{},Es=class extends Ss{},Is=class extends Ss{},Ms=class{};var Kn=require("baileys"),Pe=class{constructor(i){this.cache=i;this.logger=new v("CacheService");i?this.logger.verbose(`cacheservice created using cache engine: ${i.constructor?.name}`):this.logger.verbose("cacheservice disabled")}async get(i){if(this.cache)return this.cache.get(i)}async hGet(i,e){if(!this.cache)return null;try{let t=await this.cache.hGet(i,e);return t?JSON.parse(t,Kn.BufferJSON.reviver):null}catch(t){return this.logger.error(t),null}}async set(i,e,t){this.cache&&this.cache.set(i,e,t)}async hSet(i,e,t){if(this.cache)try{let s=JSON.stringify(t,Kn.BufferJSON.replacer);await this.cache.hSet(i,e,s)}catch(s){this.logger.error(s)}}async has(i){if(this.cache)return this.cache.has(i)}async delete(i){if(this.cache)return this.cache.delete({
evolution_api    |         where: {
evolution_api    |           instanceId: "00c1f464-6d5b-4576-a398-aa52544d1e8b",
evolution_api    |           key: {
evolution_api    |             path: [
evolution_api    |               "id"
evolution_api    |             ],
evolution_api    |             ~~~~~~
evolution_api    |             equals: "3A41DF58B93ABFE3DCE9"
evolution_api    |           }
evolution_api    |         }
evolution_api    |       })
evolution_api    | 
evolution_api    | Argument `path`: Invalid value provided. Expected String, provided (String).
evolution_api    |     at xn (/evolution/node_modules/@prisma/client/runtime/library.js:29:1363)
evolution_api    |     at Bn.handleRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7005)
evolution_api    |     at Bn.handleAndLogRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:6686)
evolution_api    |     at Bn.request (/evolution/node_modules/@prisma/client/runtime/library.js:121:6393)
evolution_api    |     at async l (/evolution/node_modules/@prisma/client/runtime/library.js:130:9645)
evolution_api    |     at async messages.update (/evolution/dist/main.js:230:28391) {
evolution_api    |   clientVersion: '6.3.1'
evolution_api    | } 
evolution_api    | 

rafwell avatar Feb 07 '25 13:02 rafwell

PrismaClientKnownRequestError:

Invalid this.cache.delete() invocation in

/evolution/dist/main.js:230:28836

227 ),o.url&&(n+=URL:${o.url}

228 ),o.wuid||(o.wuid=j(o.phoneNumber)),n+=item1.TEL;waid=${o.wuid}:${o.phoneNumber}

229 item1.X-ABLabel:Celular

→ 230 END:VCARD,n};return e.contact.length===1?t.contact={displayName:e.contact[0].fullName,vcard:s(e.contact[0])}:t.contactsArrayMessage={displayName:${e.contact.length} contacts,contacts:e.contact.map(o=>({displayName:o.fullName,vcard:s(o)}))},await this.sendMessageWithTyping(e.number,{contacts:e.contact.map(o=>({name:{formatted_name:o.fullName,first_name:o.fullName},phones:[{phone:o.phoneNumber}],urls:[{url:o.url}],emails:[{email:o.email}],org:{company:o.organization}})),message:t},{delay:e?.delay,presence:"composing",quoted:e?.quoted,linkPreview:e?.linkPreview,mentionsEveryOne:e?.mentionsEveryOne,mentioned:e?.mentioned})}async reactionMessage(e){return await this.sendMessageWithTyping(e.key.remoteJid,{reactionMessage:{key:e.key,text:e.reaction}})}async getBase64FromMediaMessage(e){try{let t=e.message,s=t.messageType.includes("Message")?t.messageType:t.messageType+"Message",o=t.message[s];return{mediaType:t.messageType,fileName:o?.fileName,caption:o?.caption,size:{fileLength:o?.fileLength,height:o?.fileLength,width:o?.width},mimetype:o?.mime_type,base64:t.message.base64}}catch(t){throw this.logger.error(t),new y(t.toString())}}async deleteMessage(){throw new y("Method not available on WhatsApp Business API")}async mediaSticker(){throw new y("Method not available on WhatsApp Business API")}async pollMessage(){throw new y("Method not available on WhatsApp Business API")}async statusMessage(){throw new y("Method not available on WhatsApp Business API")}async reloadConnection(){throw new y("Method not available on WhatsApp Business API")}async whatsappNumber(){throw new y("Method not available on WhatsApp Business API")}async markMessageAsRead(){throw new y("Method not available on WhatsApp Business API")}async archiveChat(){throw new y("Method not available on WhatsApp Business API")}async markChatUnread(){throw new y("Method not available on WhatsApp Business API")}async fetchProfile(){throw new y("Method not available on WhatsApp Business API")}async offerCall(){throw new y("Method not available on WhatsApp Business API")}async sendPresence(){throw new y("Method not available on WhatsApp Business API")}async setPresence(){throw new y("Method not available on WhatsApp Business API")}async fetchPrivacySettings(){throw new y("Method not available on WhatsApp Business API")}async updatePrivacySettings(){throw new y("Method not available on WhatsApp Business API")}async fetchBusinessProfile(){throw new y("Method not available on WhatsApp Business API")}async updateProfileName(){throw new y("Method not available on WhatsApp Business API")}async updateProfileStatus(){throw new y("Method not available on WhatsApp Business API")}async updateProfilePicture(){throw new y("Method not available on WhatsApp Business API")}async removeProfilePicture(){throw new y("Method not available on WhatsApp Business API")}async blockUser(){throw new y("Method not available on WhatsApp Business API")}async updateMessage(){throw new y("Method not available on WhatsApp Business API")}async createGroup(){throw new y("Method not available on WhatsApp Business API")}async updateGroupPicture(){throw new y("Method not available on WhatsApp Business API")}async updateGroupSubject(){throw new y("Method not available on WhatsApp Business API")}async updateGroupDescription(){throw new y("Method not available on WhatsApp Business API")}async findGroup(){throw new y("Method not available on WhatsApp Business API")}async fetchAllGroups(){throw new y("Method not available on WhatsApp Business API")}async inviteCode(){throw new y("Method not available on WhatsApp Business API")}async inviteInfo(){throw new y("Method not available on WhatsApp Business API")}async sendInvite(){throw new y("Method not available on WhatsApp Business API")}async acceptInviteCode(){throw new y("Method not available on WhatsApp Business API")}async revokeInviteCode(){throw new y("Method not available on WhatsApp Business API")}async findParticipants(){throw new y("Method not available on WhatsApp Business API")}async updateGParticipant(){throw new y("Method not available on WhatsApp Business API")}async updateGSetting(){throw new y("Method not available on WhatsApp Business API")}async toggleEphemeral(){throw new y("Method not available on WhatsApp Business API")}async leaveGroup(){throw new y("Method not available on WhatsApp Business API")}async fetchLabels(){throw new y("Method not available on WhatsApp Business API")}async handleLabel(){throw new y("Method not available on WhatsApp Business API")}async receiveMobileCode(){throw new y("Method not available on WhatsApp Business API")}async fakeCall(){throw new y("Method not available on WhatsApp Business API")}};var ut=class{constructor(i,e,t,s){this.jid=i;this.exists=e;this.number=t;this.name=s}},gs=class{},ms=class{},qe=class{};var hs=class{},fs=class{},dt=class{};var ys=class{};var ws=class{},bs=class{},Ss=class{},Es=class{};var Zn=class{},Ts=class extends Zn{},Is=class extends Ts{},Ms=class extends Ts{},Cs=class{};var eo=require("baileys"),Pe=class{constructor(i){this.cache=i;this.logger=new v("CacheService");i?this.logger.verbose(cacheservice created using cache engine: ${i.constructor?.name}`):this.logger.verbose("cacheservice disabled")}async get(i){if(this.cache)return this.cache.get(i)}async hGet(i,e){if(!this.cache)return null;try{let t=await this.cache.hGet(i,e);return t?JSON.parse(t,eo.BufferJSON.reviver):null}catch(t){return this.logger.error(t),null}}async set(i,e,t){this.cache&&this.cache.set(i,e,t)}async hSet(i,e,t){if(this.cache)try{let s=JSON.stringify(t,eo.BufferJSON.replacer);await this.cache.hSet(i,e,s)}catch(s){this.logger.error(s)}}async has(i){if(this.cache)return this.cache.has(i)}async delete(i){if(this.cache)return this.cache.delete(

Input error. A JSON path cannot be set without a scalar filter.

at Un.handleRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7447)

at Un.handleAndLogRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:6771)

at Un.request (/evolution/node_modules/@prisma/client/runtime/library.js:121:6478)

at async l (/evolution/node_modules/@prisma/client/runtime/library.js:130:9644)

at async messages.update (/evolution/dist/main.js:230:28800) {

code: 'P2019',

clientVersion: '6.4.1',

{

modelName: 'Message',

details: 'A JSON path cannot be set without a scalar filter.'

}

}

similar error

neocol83 avatar Mar 05 '25 21:03 neocol83

Todos os meus problemas relacionados a estes logs foram resolvidos quando eu troquei do mysql para o postgres. Me parece que o postgres é mais usado pela comunidade e o código é melhor mantido. A conclusão que cheguei é que, apesar de usarem o prisma como ORM, o fato de usarem muitas colunas JSON pode ser um problema, porque a sintaxe para buscar dentro de um json é diferente entre os bancos de dados.

rafwell avatar Mar 10 '25 16:03 rafwell

Todos os meus problemas relacionados a estes logs foram resolvidos quando eu troquei do mysql para o postgres. Me parece que o postgres é mais usado pela comunidade e o código é melhor mantido. A conclusão que cheguei é que, apesar de usarem o prisma como ORM, o fato de usarem muitas colunas JSON pode ser um problema, porque a sintaxe para buscar dentro de um json é diferente entre os bancos de dados.

Muito obrigado pela dica !!! Eu comecei a testar a evolution API com mysql e tive muitos problemas, ao mudar para postgres funcionou tudo de primeira, inclusive na última versão (2.2.3)

gmarruda avatar Mar 30 '25 18:03 gmarruda

Eu tentei utilizar a versão com MySQL e encontrei alguns erros quando rodei o comando de build, todos sobre tipo de parâmetro no código fonte. Eu manualmente alterei o código após analisar brevemente referências dentro do projeto e fiz sumir todos os erros, nada de maneira muito científica. Para minha surpresa, as mudanças foram suficiente e a build seguiu sem problemas. No fim, eu apenas troquei uns parâmetros de "path" que estavam recebendo um array de uma única string para apenas a string em si e os outros apenas segui a dica da IDE (VS Code). Deixo abaixo o diff do código alterado. Espero que ajude.

@@ -64,7 +64,7 @@
     "compression": "^1.7.5",
     "cors": "^2.8.5",
     "dayjs": "^1.11.13",
-    "dotenv": "^16.4.7",
+    "dotenv": "^16.5.0",
     "eventemitter2": "^6.4.9",
     "express": "^4.21.2",
     "express-async-errors": "^3.1.1",
diff --git a/src/api/integrations/channel/meta/whatsapp.business.service.ts b/src/api/integrations/channel/meta/whatsapp.business.service.ts
index 5360b9e4..b3419cea 100644
--- a/src/api/integrations/channel/meta/whatsapp.business.service.ts
+++ b/src/api/integrations/channel/meta/whatsapp.business.service.ts
@@ -578,7 +578,7 @@ export class BusinessStartupService extends ChannelStartupService {
               where: {
                 instanceId: this.instanceId,
                 key: {
-                  path: ['id'],
+                  path: 'id',
                   equals: key.id,
                 },
               },
diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
index 10feb7ce..f865d80a 100644
--- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
+++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
@@ -512,7 +512,7 @@ export class BaileysStartupService extends ChannelStartupService {
         where: {
           instanceId: this.instanceId,
           key: {
-            path: ['id'],
+            path: 'id',
             equals: key.id,
           },
         },
@@ -1450,7 +1450,7 @@ export class BaileysStartupService extends ChannelStartupService {
             where: {
               instanceId: this.instanceId,
               key: {
-                path: ['id'],
+                path: 'id',
                 equals: key.id,
               },
             },
@@ -1591,7 +1591,7 @@ export class BaileysStartupService extends ChannelStartupService {
       const savedLabel = labelsRepository.find((l) => l.labelId === label.id);
       if (label.deleted && savedLabel) {
         await this.prismaRepository.label.delete({
-          where: { labelId_instanceId: { instanceId: this.instanceId, labelId: label.id } },
+          where: { id: "", instanceId: this.instanceId, labelId: label.id },
         });
         this.sendDataWebhook(Events.LABELS_EDIT, { ...label, instance: this.instance.name });
         return;
@@ -1609,10 +1609,9 @@ export class BaileysStartupService extends ChannelStartupService {
           };
           await this.prismaRepository.label.upsert({
             where: {
-              labelId_instanceId: {
+                id: "",
                 instanceId: labelData.instanceId,
                 labelId: labelData.labelId,
-              },
             },
             update: labelData,
             create: labelData,
@@ -3555,7 +3554,7 @@ export class BaileysStartupService extends ChannelStartupService {
           let message = await this.prismaRepository.message.findFirst({
             where: {
               key: {
-                path: ['id'],
+                path: 'id',
                 equals: messageId,
               },
             },
@@ -4360,8 +4359,8 @@ export class BaileysStartupService extends ChannelStartupService {
     const result = await this.prismaRepository.message.updateMany({
       where: {
         AND: [
-          { key: { path: ['remoteJid'], equals: remoteJid } },
-          { key: { path: ['fromMe'], equals: false } },
+          { key: { path: 'remoteJid', equals: remoteJid } },
+          { key: { path: 'fromMe', equals: false } },
           { messageTimestamp: { lte: timestamp } },
           {
             OR: [{ status: null }, { status: status[3] }],
@@ -4388,8 +4387,8 @@ export class BaileysStartupService extends ChannelStartupService {
       this.prismaRepository.message.count({
         where: {
           AND: [
-            { key: { path: ['remoteJid'], equals: remoteJid } },
-            { key: { path: ['fromMe'], equals: false } },
+            { key: { path: 'remoteJid', equals: remoteJid } },
+            { key: { path: 'fromMe', equals: false } },
             { status: { equals: status[3] } },
           ],
         },
diff --git a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts
index 77b58bbe..9d69d4ea 100644
--- a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts
+++ b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts
@@ -1422,7 +1422,7 @@ export class ChatwootService {
           const lastMessage = await this.prismaRepository.message.findFirst({
             where: {
               key: {
-                path: ['fromMe'],
+                path: 'fromMe',
                 equals: false,
               },
               instanceId: instance.instanceId,
@@ -1457,7 +1457,7 @@ export class ChatwootService {
               where: {
                 instanceId: instance.instanceId,
                 key: {
-                  path: ['id'],
+                  path: 'id',
                   equals: key.id,
                 },
               },
@@ -1506,7 +1506,7 @@ export class ChatwootService {
     await this.prismaRepository.message.updateMany({
       where: {
         key: {
-          path: ['id'],
+          path: 'id',
           equals: key.id,
         },
         instanceId: instance.instanceId,
@@ -1529,7 +1529,7 @@ export class ChatwootService {
     const messages = await this.prismaRepository.message.findFirst({
       where: {
         key: {
-          path: ['id'],
+          path: 'id',
           equals: keyId,
         },
         instanceId: instance.instanceId,
@@ -1910,7 +1910,7 @@ export class ChatwootService {
           quotedMsg = await this.prismaRepository.message.findFirst({
             where: {
               key: {
-                path: ['id'],
+                path: 'id',
                 equals: quotedId,
               },
               chatwootMessageId: {
@@ -2183,7 +2183,7 @@ export class ChatwootService {
             await this.prismaRepository.message.deleteMany({
               where: {
                 key: {
-                  path: ['id'],
+                  path: 'id',
                   equals: body.key.id,
                 },
                 instanceId: instance.instanceId,
@@ -2488,7 +2488,7 @@ export class ChatwootService {
         where: {
           Instance: { name: instance.instanceName },
           messageTimestamp: { gte: dayjs().subtract(6, 'hours').unix() },
-          AND: ids.map((id) => ({ key: { path: ['id'], not: id } })),
+          AND: ids.map((id) => ({ key: { path: 'id', not: id } })),
         },
       });

diff --git a/src/api/services/channel.service.ts b/src/api/services/channel.service.ts
index 0f30f0c9..87b5bb9d 100644
--- a/src/api/services/channel.service.ts
+++ b/src/api/services/channel.service.ts
@@ -592,10 +592,10 @@ export class ChannelStartupService {
         messageType: query?.where?.messageType,
         ...timestampFilter,
         AND: [
-          keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
-          keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
-          keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
-          keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},
+          keyFilters?.id ? { key: { path: 'id', equals: keyFilters?.id } } : {},
+          keyFilters?.fromMe ? { key: { path: 'fromMe', equals: keyFilters?.fromMe } } : {},
+          keyFilters?.remoteJid ? { key: { path: 'remoteJid', equals: keyFilters?.remoteJid } } : {},
+          keyFilters?.participants ? { key: { path: 'participants', equals: keyFilters?.participants } } : {},
         ],
       },
     });
@@ -616,10 +616,10 @@ export class ChannelStartupService {
         messageType: query?.where?.messageType,
         ...timestampFilter,
         AND: [
-          keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
-          keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
-          keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
-          keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},
+          keyFilters?.id ? { key: { path: 'id', equals: keyFilters?.id } } : {},
+          keyFilters?.fromMe ? { key: { path: 'fromMe', equals: keyFilters?.fromMe } } : {},
+          keyFilters?.remoteJid ? { key: { path: 'remoteJid', equals: keyFilters?.remoteJid } } : {},
+          keyFilters?.participants ? { key: { path: 'participants', equals: keyFilters?.participants } } : {},
         ],
       },
       orderBy: {

GabrielRosa835 avatar May 29 '25 19:05 GabrielRosa835