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

Erro ao enviar arquivo com o mesmo nome através da opção DOCUMENTO, pelo whatsapp WEB

Open matheusagnes opened this issue 1 year ago • 1 comments

Welcome!

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

What did you do?

Quando o usuário envia duas vezes ou mais um arquivo com o mesmo nome, através da opção DOCUMENTO, através do WHATSAPP WEB, está dando erro.

Percebi que existe uma chave unica no banco de dados com o nome do arquivo.

Minha sugestão é ter um ID unico para o nome do arquivo.

What did you expect?

Não dar erro

What did you observe instead of what you expected?

Está dando o seguinte erro:

[ 'Error on upload file to minio', '\n' + 'Invalid this.cache.delete() invocation in\n' + '/evolution/dist/main.js:194:19015\n' + '\n' + ' 191 ),o.url&&(n+=URL:${o.url}\n' + ' 192 ),o.wuid||(o.wuid=this.createJid(o.phoneNumber)),n+=item1.TEL;waid=${o.wuid}:${o.phoneNumber}\n' + ' 193 item1.X-ABLabel:Celular\n' + '→ 194 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 h(t.toString())}}async deleteMessage(){throw new h("Method not available on WhatsApp Business API")}async mediaSticker(){throw new h("Method not available on WhatsApp Business API")}async pollMessage(){throw new h("Method not available on WhatsApp Business API")}async statusMessage(){throw new h("Method not available on WhatsApp Business API")}async reloadConnection(){throw new h("Method not available on WhatsApp Business API")}async whatsappNumber(){throw new h("Method not available on WhatsApp Business API")}async markMessageAsRead(){throw new h("Method not available on WhatsApp Business API")}async archiveChat(){throw new h("Method not available on WhatsApp Business API")}async markChatUnread(){throw new h("Method not available on WhatsApp Business API")}async fetchProfile(){throw new h("Method not available on WhatsApp Business API")}async sendPresence(){throw new h("Method not available on WhatsApp Business API")}async setPresence(){throw new h("Method not available on WhatsApp Business API")}async fetchPrivacySettings(){throw new h("Method not available on WhatsApp Business API")}async updatePrivacySettings(){throw new h("Method not available on WhatsApp Business API")}async fetchBusinessProfile(){throw new h("Method not available on WhatsApp Business API")}async updateProfileName(){throw new h("Method not available on WhatsApp Business API")}async updateProfileStatus(){throw new h("Method not available on WhatsApp Business API")}async updateProfilePicture(){throw new h("Method not available on WhatsApp Business API")}async removeProfilePicture(){throw new h("Method not available on WhatsApp Business API")}async blockUser(){throw new h("Method not available on WhatsApp Business API")}async updateMessage(){throw new h("Method not available on WhatsApp Business API")}async createGroup(){throw new h("Method not available on WhatsApp Business API")}async updateGroupPicture(){throw new h("Method not available on WhatsApp Business API")}async updateGroupSubject(){throw new h("Method not available on WhatsApp Business API")}async updateGroupDescription(){throw new h("Method not available on WhatsApp Business API")}async findGroup(){throw new h("Method not available on WhatsApp Business API")}async fetchAllGroups(){throw new h("Method not available on WhatsApp Business API")}async inviteCode(){throw new h("Method not available on WhatsApp Business API")}async inviteInfo(){throw new h("Method not available on WhatsApp Business API")}async sendInvite(){throw new h("Method not available on WhatsApp Business API")}async acceptInviteCode(){throw new h("Method not available on WhatsApp Business API")}async revokeInviteCode(){throw new h("Method not available on WhatsApp Business API")}async findParticipants(){throw new h("Method not available on WhatsApp Business API")}async updateGParticipant(){throw new h("Method not available on WhatsApp Business API")}async updateGSetting(){throw new h("Method not available on WhatsApp Business API")}async toggleEphemeral(){throw new h("Method not available on WhatsApp Business API")}async leaveGroup(){throw new h("Method not available on WhatsApp Business API")}async fetchLabels(){throw new h("Method not available on WhatsApp Business API")}async handleLabel(){throw new h("Method not available on WhatsApp Business API")}async receiveMobileCode(){throw new h("Method not available on WhatsApp Business API")}async fakeCall(){throw new h("Method not available on WhatsApp Business API")}};var et=class{constructor(i,e,t,s){this.jid=i;this.exists=e;this.number=t;this.name=s}},os=class{},rs=class{},ft=class{};var as=class{},cs=class{},tt=class{};var ps=class{};var ls=class{},us=class{},gs=class{},ds=class{};var On=class{},hs=class extends On{},ms=class extends hs{},ys=class extends hs{},fs=class{};var xn=require("baileys"),me=class{constructor(i){this.cache=i;this.logger=new S("CacheService");i?this.logger.info(cacheservice created using cache engine: ${i.constructor?.name}):this.logger.info("cacheservice disabled")}async get(i){if(this.cache)return this.cache.get(i)}async hGet(i,e){try{let t=await this.cache.hGet(i,e);return t?JSON.parse(t,xn.BufferJSON.reviver):null}catch(t){return this.logger.error(t),null}}async set(i,e){this.cache&&this.cache.set(i,e)}async hSet(i,e,t){try{let s=JSON.stringify(t,xn.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(\n' + 'Unique constraint failed on the fields: (fileName)', 'PrismaClientKnownRequestError: \n' + 'Invalid this.cache.delete()invocation in\n' + '/evolution/dist/main.js:194:19015\n' + '\n' + ' 191),o.url&&(n+=URL:${o.url}\n' + ' 192 ),o.wuid||(o.wuid=this.createJid(o.phoneNumber)),n+=item1.TEL;waid=${o.wuid}:${o.phoneNumber}\n' + ' 193 item1.X-ABLabel:Celular\n' + '→ 194 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 h(t.toString())}}async deleteMessage(){throw new h("Method not available on WhatsApp Business API")}async mediaSticker(){throw new h("Method not available on WhatsApp Business API")}async pollMessage(){throw new h("Method not available on WhatsApp Business API")}async statusMessage(){throw new h("Method not available on WhatsApp Business API")}async reloadConnection(){throw new h("Method not available on WhatsApp Business API")}async whatsappNumber(){throw new h("Method not available on WhatsApp Business API")}async markMessageAsRead(){throw new h("Method not available on WhatsApp Business API")}async archiveChat(){throw new h("Method not available on WhatsApp Business API")}async markChatUnread(){throw new h("Method not available on WhatsApp Business API")}async fetchProfile(){throw new h("Method not available on WhatsApp Business API")}async sendPresence(){throw new h("Method not available on WhatsApp Business API")}async setPresence(){throw new h("Method not available on WhatsApp Business API")}async fetchPrivacySettings(){throw new h("Method not available on WhatsApp Business API")}async updatePrivacySettings(){throw new h("Method not available on WhatsApp Business API")}async fetchBusinessProfile(){throw new h("Method not available on WhatsApp Business API")}async updateProfileName(){throw new h("Method not available on WhatsApp Business API")}async updateProfileStatus(){throw new h("Method not available on WhatsApp Business API")}async updateProfilePicture(){throw new h("Method not available on WhatsApp Business API")}async removeProfilePicture(){throw new h("Method not available on WhatsApp Business API")}async blockUser(){throw new h("Method not available on WhatsApp Business API")}async updateMessage(){throw new h("Method not available on WhatsApp Business API")}async createGroup(){throw new h("Method not available on WhatsApp Business API")}async updateGroupPicture(){throw new h("Method not available on WhatsApp Business API")}async updateGroupSubject(){throw new h("Method not available on WhatsApp Business API")}async updateGroupDescription(){throw new h("Method not available on WhatsApp Business API")}async findGroup(){throw new h("Method not available on WhatsApp Business API")}async fetchAllGroups(){throw new h("Method not available on WhatsApp Business API")}async inviteCode(){throw new h("Method not available on WhatsApp Business API")}async inviteInfo(){throw new h("Method not available on WhatsApp Business API")}async sendInvite(){throw new h("Method not available on WhatsApp Business API")}async acceptInviteCode(){throw new h("Method not available on WhatsApp Business API")}async revokeInviteCode(){throw new h("Method not available on WhatsApp Business API")}async findParticipants(){throw new h("Method not available on WhatsApp Business API")}async updateGParticipant(){throw new h("Method not available on WhatsApp Business API")}async updateGSetting(){throw new h("Method not available on WhatsApp Business API")}async toggleEphemeral(){throw new h("Method not available on WhatsApp Business API")}async leaveGroup(){throw new h("Method not available on WhatsApp Business API")}async fetchLabels(){throw new h("Method not available on WhatsApp Business API")}async handleLabel(){throw new h("Method not available on WhatsApp Business API")}async receiveMobileCode(){throw new h("Method not available on WhatsApp Business API")}async fakeCall(){throw new h("Method not available on WhatsApp Business API")}};var et=class{constructor(i,e,t,s){this.jid=i;this.exists=e;this.number=t;this.name=s}},os=class{},rs=class{},ft=class{};var as=class{},cs=class{},tt=class{};var ps=class{};var ls=class{},us=class{},gs=class{},ds=class{};var On=class{},hs=class extends On{},ms=class extends hs{},ys=class extends hs{},fs=class{};var xn=require("baileys"),me=class{constructor(i){this.cache=i;this.logger=new S("CacheService");i?this.logger.info(cacheservice created using cache engine: ${i.constructor?.name}):this.logger.info("cacheservice disabled")}async get(i){if(this.cache)return this.cache.get(i)}async hGet(i,e){try{let t=await this.cache.hGet(i,e);return t?JSON.parse(t,xn.BufferJSON.reviver):null}catch(t){return this.logger.error(t),null}}async set(i,e){this.cache&&this.cache.set(i,e)}async hSet(i,e,t){try{let s=JSON.stringify(t,xn.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(\n' + 'Unique constraint failed on the fields: (fileName)\n' + ' at _n.handleRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7749)\n' + ' at _n.handleAndLogRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7057)\n' + ' at _n.request (/evolution/node_modules/@prisma/client/runtime/library.js:121:6741)\n' + ' at async l (/evolution/node_modules/@prisma/client/runtime/library.js:130:9355)\n' + ' at async messages.upsert (/evolution/dist/main.js:194:18981)' ]

Screenshots/Videos

No response

Which version of the API are you using?

2.1

What is your environment?

Windows

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

No response

matheusagnes avatar Sep 11 '24 12:09 matheusagnes

Same issue

Documents with same name no delivered on webhook

lucas-tomasi avatar Oct 06 '24 18:10 lucas-tomasi

Mesmo erro aqui.

thaina128 avatar Nov 12 '24 20:11 thaina128

Chegaram a testar em uma versão mais recente do evolution como 2.1.2 ou 2.2.0?

dpaes avatar Dec 03 '24 22:12 dpaes