Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spree - Timeout when trying to access backend

Since this afternoon, access to the backend of my spree shop is suddenly unavailable. When I try to visit any page in the backend (/admin/users, /admin/orders, etc) the page just loads for a long time, until it times out and I get the generic error page.

When I look into the logs I always see either :

Processing by Spree::Admin::OrdersController#index as HTML
Completed 500 Internal Server Error in 127259ms
** [Airbrake] Success: Net::HTTPOK

Errno::ETIMEDOUT (Connection timed out - connect(2)):
  app/middleware/flash_session_cookie_middleware.rb:18:in `call'

or

Processing by Spree::Admin::OrdersController#index as HTML
Completed 500 Internal Server Error in 127520ms
** [Airbrake] Success: Net::HTTPOK

SocketError (getaddrinfo: Name or service not known):
app/middleware/flash_session_cookie_middleware.rb:17:in `call'

This started happening after the last deployment to production, which only changed images and stylesheets. I can't reproduce the error locally, despite having the same code and an exact copy of the production database. I'm using Spree version 2.0.3

like image 246
Max Avatar asked Dec 19 '22 00:12

Max


1 Answers

Run Spree::Config[:check_for_spree_alerts] = false in your console to fix this. You may also want to add this line to your initializers/spree.rb to ensure check_for_spree_alerts is not re-enabled in the future.

This is happening because the Spree Alerts website has been discontinued. See: https://github.com/spree/spree/pull/6516

To be specific, this is happening because when logging into the backend, Spree 2.0.x checks for any alerts from the Spree website here https://github.com/spree/spree/blob/2-0-stable/backend/app/controllers/spree/admin/base_controller.rb#L39 which then calls alert.rb:14 :

HTTParty.get('http://alerts.spreecommerce.com/alerts.json', query: params).parsed_response

At the moment, alerts.spreecommerce.com has been discontinued and is timing out, which explains the errors you're receiving.

The Spree Alerts code has been removed as of Spree 2.3, so you could also upgrade to that version to resolve this issue.

like image 135
Ian Zabel Avatar answered Dec 27 '22 05:12

Ian Zabel