Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disappearing Inboxes (after v3.0 upgrade) #7744

Open
jochenstu opened this issue Aug 16, 2023 · 23 comments
Open

Disappearing Inboxes (after v3.0 upgrade) #7744

jochenstu opened this issue Aug 16, 2023 · 23 comments
Labels
🐧 self-hosted/linux Issues related to the self-hosted installations on Linux VM self-hosted Issues about self-hosted Chatwoot installations waiting-for-reply

Comments

@jochenstu
Copy link

jochenstu commented Aug 16, 2023

Describe the bug

After upgrading to v3 and logging in, my inboxes have disappeard:

image

The URL after logging in reads chatwoot.domain.tld/app/accounts/1/dashboard. Now, when I clear the path out of the URL, so it reads chatwoot.domain.tld, and I press enter, everything appears to be in perfect working order:

image

At this stage everything seems to be working fine – until after reloading the app manually, when the inboxes will be gone again.

To Reproduce

I really do not know. I upgraded to v3, ran into issues due to node 18, installed 16, recompiled – and this is where I ended up.

Expected behavior

No response

Environment

Linux VM

Cloud Provider

Other [please specify in the description]

Platform

Browser

Operating system

MacOS

Browser and version

Current Chrome

Docker (if applicable)

No response

Additional context

Hosted on Hetzner

@vishnu-narayanan
Copy link
Member

@jochenstu Which version of Chatwoot were you upgrading from? Also, your OS version?

@vishnu-narayanan vishnu-narayanan added self-hosted Issues about self-hosted Chatwoot installations waiting-for-reply 🐧 self-hosted/linux Issues related to the self-hosted installations on Linux VM labels Aug 17, 2023
@jochenstu
Copy link
Author

jochenstu commented Aug 17, 2023

Upgrade from Chatwoot Version: 2.18.0
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"

I have used and always upgraded this instance for ~12 month now using cwctl.

@vishnu-narayanan
Copy link
Member

@jochenstu Thank you for letting us know. Just wanted to check whether you are upgrading from a very old version.

SInce the inboxes show up, migrations/upgrade seems to have worked. Could you try a different browser or incognito window? Any error logs on browser console?

@gadonski
Copy link

+1

@jochenstu
Copy link
Author

Sure! After clearing the site cookies the issue is gone. Thanks for the pointer. I don't know what to make off that. Should probably better be avoided, but probably not worth investigating further.

@JustinBack
Copy link

Got the same issue, clearing cookies does not fix the bug.

Though I get the following errors in the rails console:

rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] ActionView::Template::Error (undefined method `business_name' for #<Inb
ox id: 3, channel_id: 2, account_id: 1, name: "`******", created_at: "2023-07-31 21:52:03.511102000 +0000"
, updated_at: "2023-08-01 11:31:02.270205000 +0000", channel_type: "Channel::Email", enable_auto_assignment: true, greeting_
enabled: true, greeting_message: "Hallo {{contact.name}},\r\n\r\nVielen Dank für Ihre Na...", email_address: nil, working_ho
urs_enabled: false, out_of_office_message: nil, timezone: "UTC", enable_email_collect: true, csat_survey_enabled: true, allo
w_messages_after_resolved: true, auto_assignment_config: {}, lock_to_single_conversation: false, portal_id: 1, sender_name_t
ype: nil>):
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     17: json.allow_messages_after_resolved resource.allow_messages_afte
r_resolved
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     18: json.lock_to_single_conversation resource.lock_to_single_conver
sation
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     19: json.sender_name_type resource.sender_name_type
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     20: json.business_name resource.business_name
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     21: 
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     22: if resource.portal.present?
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     23:   json.help_center do
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]   
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/models/_inbox.json.jbuilder:20
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/accounts/inboxes/index.json.jbuilder:3
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/accounts/inboxes/index.json.jbuilder:2
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/accounts/inboxes/index.json.jbuilder:1
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/switch_locale.rb:24:in `set_locale'
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/switch_locale.rb:16:in `switch_locale_using_ac
count_locale'
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/request_exception_handler.rb:11:in `handle_wit
h_exception'
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/switch_locale.rb:24:in `set_locale'

rails_1     | F, [2023-08-17T20:27:08.275793 #1] FATAL -- : [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]   
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] ActionView::Template::Error (undefined method `waiting_since' for #<Con
versation id: 27, account_id: 1, inbox_id: 1, status: "open", assignee_id: 1, created_at: "2023-08-11 17:45:41.678476000 +00
00", updated_at: "2023-08-11 17:45:47.078781000 +0000", contact_id: 11, display_id: 27, contact_last_seen_at: nil, agent_las
t_seen_at: "2023-08-12 16:10:39.259802000 +0000", additional_attributes: {"mail_subject"=>"Buchhaltung"}, contact_inbox_id: 
16, uuid: "f7f6ee72-3e6e-40c2-a70a-89a076c6d16b", identifier: nil, last_activity_at: "2023-08-11 17:45:41.701298000 +0000", 
team_id: nil, campaign_id: nil, snoozed_until: nil, custom_attributes: {}, assignee_last_seen_at: "2023-08-12 16:10:39.25980
2000 +0000", first_reply_created_at: "2023-08-11 17:45:41.701298000 +0000", priority: nil, label_list: nil>):
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     46: json.last_non_activity_message conversation.messages.where(acco
unt_id: conversation.account_id).non_activity_messages.first.try(:push_event_data)
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     47: json.last_activity_at conversation.last_activity_at.to_i
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     48: json.priority conversation.priority
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     49: json.waiting_since conversation.waiting_since.to_i.to_i
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]   
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/conversations/partials/_conversation.json.jbuilder:49
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:10
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:9
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:8
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:1
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:24:in `set_locale'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:16:in `switch_locale_using_ac
count_locale'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/request_exception_handler.rb:11:in `handle_wit
h_exception'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:24:in `set_locale'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:11:in `switch_locale'
rails_1     | I, [2023-08-17T20:27:08.276027 #1]  INFO -- : source=rack-timeout id=5b45fcf6-5518-4d3f-8f4e-a46e21031f0e time
out=15000ms service=139ms state=completed

@ZiekBaboon
Copy link

Same problem here.

From 2.18 to 3.0.0

updated to node 16
ubuntu 20

@ZiekBaboon
Copy link

ZiekBaboon commented Aug 17, 2023

Fixed after upgrading Ruby to 3.2.2, i was using 3.1

@jochenstu wich version do you have?

@sojan-official
Copy link
Member

Got the same issue, clearing cookies does not fix the bug.

Though I get the following errors in the rails console:

rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] ActionView::Template::Error (undefined method `business_name' for #<Inb
ox id: 3, channel_id: 2, account_id: 1, name: "`******", created_at: "2023-07-31 21:52:03.511102000 +0000"
, updated_at: "2023-08-01 11:31:02.270205000 +0000", channel_type: "Channel::Email", enable_auto_assignment: true, greeting_
enabled: true, greeting_message: "Hallo {{contact.name}},\r\n\r\nVielen Dank für Ihre Na...", email_address: nil, working_ho
urs_enabled: false, out_of_office_message: nil, timezone: "UTC", enable_email_collect: true, csat_survey_enabled: true, allo
w_messages_after_resolved: true, auto_assignment_config: {}, lock_to_single_conversation: false, portal_id: 1, sender_name_t
ype: nil>):
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     17: json.allow_messages_after_resolved resource.allow_messages_afte
r_resolved
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     18: json.lock_to_single_conversation resource.lock_to_single_conver
sation
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     19: json.sender_name_type resource.sender_name_type
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     20: json.business_name resource.business_name
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     21: 
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     22: if resource.portal.present?
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]     23:   json.help_center do
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013]   
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/models/_inbox.json.jbuilder:20
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/accounts/inboxes/index.json.jbuilder:3
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/accounts/inboxes/index.json.jbuilder:2
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/views/api/v1/accounts/inboxes/index.json.jbuilder:1
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/switch_locale.rb:24:in `set_locale'
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/switch_locale.rb:16:in `switch_locale_using_ac
count_locale'
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/request_exception_handler.rb:11:in `handle_wit
h_exception'
rails_1     | [77cd69b8-78c0-4683-a067-9fff18abc013] app/controllers/concerns/switch_locale.rb:24:in `set_locale'

rails_1     | F, [2023-08-17T20:27:08.275793 #1] FATAL -- : [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]   
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] ActionView::Template::Error (undefined method `waiting_since' for #<Con
versation id: 27, account_id: 1, inbox_id: 1, status: "open", assignee_id: 1, created_at: "2023-08-11 17:45:41.678476000 +00
00", updated_at: "2023-08-11 17:45:47.078781000 +0000", contact_id: 11, display_id: 27, contact_last_seen_at: nil, agent_las
t_seen_at: "2023-08-12 16:10:39.259802000 +0000", additional_attributes: {"mail_subject"=>"Buchhaltung"}, contact_inbox_id: 
16, uuid: "f7f6ee72-3e6e-40c2-a70a-89a076c6d16b", identifier: nil, last_activity_at: "2023-08-11 17:45:41.701298000 +0000", 
team_id: nil, campaign_id: nil, snoozed_until: nil, custom_attributes: {}, assignee_last_seen_at: "2023-08-12 16:10:39.25980
2000 +0000", first_reply_created_at: "2023-08-11 17:45:41.701298000 +0000", priority: nil, label_list: nil>):
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     46: json.last_non_activity_message conversation.messages.where(acco
unt_id: conversation.account_id).non_activity_messages.first.try(:push_event_data)
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     47: json.last_activity_at conversation.last_activity_at.to_i
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     48: json.priority conversation.priority
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]     49: json.waiting_since conversation.waiting_since.to_i.to_i
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e]   
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/conversations/partials/_conversation.json.jbuilder:49
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:10
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:9
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:8
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/views/api/v1/accounts/conversations/index.json.jbuilder:1
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:24:in `set_locale'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:16:in `switch_locale_using_ac
count_locale'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/request_exception_handler.rb:11:in `handle_wit
h_exception'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:24:in `set_locale'
rails_1     | [5b45fcf6-5518-4d3f-8f4e-a46e21031f0e] app/controllers/concerns/switch_locale.rb:11:in `switch_locale'
rails_1     | I, [2023-08-17T20:27:08.276027 #1]  INFO -- : source=rack-timeout id=5b45fcf6-5518-4d3f-8f4e-a46e21031f0e time
out=15000ms service=139ms state=completed

This look like a case of migrations not being run..

also did you restart the services after running the migrations ?

@JustinBack
Copy link

Yeah I ran migrations and re-created containers

@sojan-official
Copy link
Member

@JustinBack could you login to the super admin and clear the frontend cache for this account. the option will be available in accounts edit page.

@grupale
Copy link

grupale commented Sep 3, 2023

Hi @sojan-official I'm having the same issue after restoring a production database into a fresh updated instalation. After restoring I ran a manual update process an this errors ocurrs during migrations

image
image
image

I'm upgrading from a restored database backup which ran v2.14. What sould I check or fix to run correctly the migrations? Thanks

@grupale
Copy link

grupale commented Sep 4, 2023

Hi @sojan-official I'm having the same issue after restoring a production database into a fresh updated instalation. After restoring I ran a manual update process an this errors ocurrs during migrations

image image image

I'm upgrading from a restored database backup which ran v2.14. What sould I check or fix to run correctly the migrations? Thanks

Hi @sojan-official I've manage to solve this issue by deleting the index mentioned in the migration error. After deleting I ran again the update process and inboxes are working properly

@danielthedifficult
Copy link

I had this same issue, fixed my heart attack by running docker compose run --rm rails bundle exec rails db:chatwoot_prepare then docker compose restart

@vishnu-narayanan this is the second time that I've had to manually run the migrations. Is there a setting or something I could check to ensure they are getting properly run when a new update boots up?

Thank you

@vishnu-narayanan
Copy link
Member

vishnu-narayanan commented Sep 20, 2023

@danielthedifficult Apologies for that 😅

For docker deployment method, one is expected to run the migrations after updating the image.

Finally you may need to update the database: docker compose run --rm rails bundle exec rails db:chatwoot_prepare

ref #1: https://www.chatwoot.com/docs/self-hosted/deployment/docker#upgrading
ref #2: https://www.chatwoot.com/docs/self-hosted/deployment/upgrade#docker

@danielthedifficult
Copy link

danielthedifficult commented Sep 20, 2023

Okay. So it's something I add in my own upgrade and maintenance scripts, and not in the inherent upgrade process you create for a release. Ok!

Is there any downside to running the migration command "too many times" - I.e. is it idempotent ?

@vishnu-narayanan
Copy link
Member

@danielthedifficult Yes, for Linux/helm installations we handle the migration in the upgrade process.

For docker, you will have to run it after every upgrade. And the migrations are idempotent. So no issues if you run it multiple times.

@danielthedifficult
Copy link

@vishnu-narayanan sorry to keep bugging you. I've read the links you've shared, and they explain perfectly "how" to do the upgrade, but i'm not 100% sur on when to implement it.

I have the following script that runs weekly to update the chatwoot service.

docker-compose down
docker-compose pull
docker-compose up -d
docker exec -it $(basename $(pwd))_rails_1 sh -c 'RAILS_ENV=production bundle exec rails db:chatwoot_prepare'

However the db migration is not getting executed properly. I think it is because the docker exec is running before the rails container is booted, but I'm not clear on how I should go about it.

Any tips you have would be welcome.

@vishnu-narayanan
Copy link
Member

@danielthedifficult Would adding a sleep 30 after docker-compose up -d work?

@danielthedifficult
Copy link

Happy to do that, it's what I was thinking.

Do I need to reboot the stack again after a migration ?

@vishnu-narayanan
Copy link
Member

Do I need to reboot the stack again after a migration ?

Not needed

@lucianodltec
Copy link

@JustinBack could you login to the super admin and clear the frontend cache for this account. the option will be available in accounts edit page.

I had this issue after deleting an inbox and this solution worked for me! Thanks @JustinBack

@gnwankpa
Copy link

Sure! After clearing the site cookies the issue is gone. Thanks for the pointer. I don't know what to make off that. Should probably better be avoided, but probably not worth investigating further.

This worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐧 self-hosted/linux Issues related to the self-hosted installations on Linux VM self-hosted Issues about self-hosted Chatwoot installations waiting-for-reply
Projects
None yet
Development

No branches or pull requests

10 participants