chatwoot / chatwoot

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬
https://www.chatwoot.com/help-center
Other
20.62k stars 3.39k forks source link

Attachments are not saved in the email channel #10184

Open MaoBueno opened 3 hours ago

MaoBueno commented 3 hours ago

Describe the bug

Hello When you receive an email with an attachment you can see the email in chatwoot but you cannot download the attachment, this only happens with received emails, as with sent emails you can download attachments The problem is that they cannot be downloaded because the file does not exist, although there is a reference in the database, it is not saved in the file system

Environment: Docker (Portainer) Cloud provider: hetzner

To Reproduce

  1. The email arrives correctly imagen

  2. When downloading the file does not exist imagen

  3. When obtaining the blob_id and its respective key to verify the file in the local file system, it was not saved

  4. The file key is: ippik1xpsge4aiujcjrrvwu4oih0 imagen

  5. We know that the file path is app/storage/ip/pi (first characters of the key) and it is not in the local file system imagen

  6. The logs do not show errors when receiving email imagen

[2024-09-23T23:47:08.448893 #1] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [9adb0f57-a6dd-48a8-a06a-35fde5072772] Enqueued ActionCableBroadcastJob (Job ID: a7b25585-ce20-496f-9c18-1e333a027559) to Sidekiq(critical) with arguments: ["YAjUnK5Ssq9GyNe8qEq2PfEc", "P2xu3Bd2VMaHJuATDcLkzrLL", "h5LTNE17TapPmEHajXLY1dfQ", "Rm457HawvAxgMEidNqjywcM9", "3FyqZ1cVZbZpmnw48chRh7qp", "NKXBNnAkwDsCAxuJ1qq6dtXs"], "conversation.created", {:additional_attributes=>{"source"=>"email", "in_reply_to"=>nil, "mail_subject"=>"Test file", "initiated_at"=>{"timestamp"=>"2024-09-23T21:47:08.224Z"}}, :can_reply=>true, :channel=>"Channel::Email", :contact_inbox=>#<GlobalID:0x00007f4338a0eec0 @uri=#<URI::GID gid://chatwoot/ContactInbox/6837>>, :id=>7158, :inbox_id=>18, :messages=>[{:id=>66857, :content=>"This is a test\n\n-- \n\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\nCelular: 310471****", :account_id=>2, :inbox_id=>18, :conversation_id=>7158, :message_type=>0, :created_at=>1727128028, :updated_at=>Mon, 23 Sep 2024 21:47:08.337512000 UTC +00:00, :private=>false, :status=>"sent", :source_id=>"CAO=SDLhMrbSGn6VzWYY2+7vz=qCt627d2s5UNFhDZhfOaGKZ2A@mail.gmail.com", :content_type=>"incoming_email", :content_attributes=>{"email"=>{"bcc"=>nil, "cc"=>nil, "content_type"=>"multipart/mixed; boundary=00000000000079a6550622d052a2", "date"=>"2024-09-23T16:45:55-05:00", "from"=>["mauroalterna****@gmail.com"], "html_content"=>{"full"=>"<div dir=\"ltr\">This is a test<br clear=\"all\"><div><br><span class=\"gmail_signature_prefix\">-- </span><br><div dir=\"ltr\" class=\"gmail_signature\" data-smartmail=\"gmail_signature\"><div dir=\"ltr\"><b>Mauricio Bueno Osorio<br></b>Ing. Sistemas y Computación<br>Celular: 310471****<br></div></div></div></div>\r\n", "reply"=>"This is a test\n\n--\nMauricio Bueno OsorioIng. Sistemas y Computación\nCelular: 310471****", "quoted"=>"This is a test"}, "in_reply_to"=>nil, "message_id"=>"CAO=SDLhMrbSGn6VzWYY2+7vz=qCt627d2s5UNFhDZhfOaGKZ2A@mail.gmail.com", "multipart"=>true, "number_of_attachments"=>1, "subject"=>"Test file", "text_content"=>{"full"=>"This is a test\r\n\r\n-- \r\n\r\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\r\nCelular: 310471****\r\n", "reply"=>"This is a test\n\n-- \n\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\nCelular: 310471****", "quoted"=>"This is a test"}, "to"=>["info@*****.com"]}, "cc_email"=>nil, "bcc_email"=>nil}, :sender_type=>"Contact", :sender_id=>5446, :external_source_ids=>{}, :additional_attributes=>{}, :processed_message_content=>"This is a test", :sentiment=>{}, :conversation=>{:assignee_id=>nil, :unread_count=>1, :last_activity_at=>1727128028, :contact_inbox=>{:source_id=>"mauroalterna****@gmail.com"}}, :attachments=>[{:id=>5408, :message_id=>66857, :file_type=>"file", :account_id=>2, :extension=>nil, :data_url=>"https://desk.vi*****.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBcmM1IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--ea774d0c014a984685645aa58c2a36c6b86a6322/energia-limpia.pdf", :thumb_url=>"", :file_size=>760025, :width=>nil, :height=>nil}], :sender=>{:additional_attributes=>{"source_id"=>"email:CAO=SDLjZ3Tt8gg=-y8SVcBD+tA1_PrtPUVudh+V6Sa_ZThwLCQ@mail.gmail.com"}, :custom_attributes=>{}, :email=>"mauroalterna****@gmail.com", :id=>5446, :identifier=>nil, :name=>"Mauricio Bueno", :phone_number=>nil, :thumbnail=>"", :type=>"contact"}}], :labels=>[], :meta=>{:sender=>{:additional_attributes=>{"source_id"=>"email:CAO=SDLjZ3Tt8gg=-y8SVcBD+tA1_PrtPUVudh+V6Sa_ZThwLCQ@mail.gmail.com"}, :custom_attributes=>{}, :email=>"mauroalterna****@gmail.com", :id=>5446, :identifier=>nil, :name=>"Mauricio Bueno", :phone_number=>nil, :thumbnail=>"", :type=>"contact"}, :assignee=>nil, :team=>nil, :hmac_verified=>false}, :status=>"open", :custom_attributes=>{}, :snoozed_until=>nil, :unread_count=>1, :first_reply_created_at=>nil, :priority=>nil, :waiting_since=>1727128028, :agent_last_seen_at=>0, :contact_last_seen_at=>0, :last_activity_at=>1727128028, :timestamp=>1727128028, :created_at=>1727128028, :account_id=>2}

Note: when I receive files from other channels if they are saved correctly, or when the attachment is from a sent email it is also saved correctly, the error is when an email is received with an attached file

Expected behavior

What is expected is that the attachment that comes in the email can be downloaded

Environment

Docker

Cloud Provider

Other [please specify in the description]

Platform

None

Operating system

No response

Browser and version

No response

Docker (if applicable)

#~# docker version
Client: Docker Engine - Community
Version: 25.0.5
API version: 1.44
Go version: go1.21.8
Git commit: 5dc9bcc
Built: Tue Mar 19 15:05:10 2024
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 25.0.5
API version: 1.44 (minimum version 1.24)
Go version: go1.21.8
Git commit: e63daec
Built: Tue Mar 19 15:05:10 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0

docker info

Client: Docker Engine - Community
Version: 25.0.5
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.13.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.25.0
Path: /usr/libexec/docker/cli-plugins/docker-compose

Server:
Containers: 19
Running: 18
Paused: 1
Stopped: 0
Images: 168
Server Version: 25.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: active
NodeID: koaicju89ekxlvxl7********
Is Manager: true
ClusterID: xtacofutlhkyvkyf********
Managers: 1
Nodes: 1
Default Address Pool: *******
SubnetSize: 24
Data Path Port: ****
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: ********
Manager Addresses:

Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b*****
runc version: v1.1.12-0-g51d5e94
init version: de4***
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.15.0-107-generic
Operating System: Ubuntu 22.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.25GiB
Name: man***
ID: c1cd86d7-397b-4e5b-********7
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:

Live Restore Enabled: false

Additional context

No response

linear[bot] commented 3 hours ago

PR-1385 Attachments are not saved in the email channel