Need help to fix ERR 500

Redeployed and it is being written to now - with 664 permissions. Thanks for the tip.

Hi,
I find the bugsnag.rb file on openfoodnetwork/current/config
The content is like you show it.
should I move this file un config/initializers ?

My envirronement is test, is there something to update in the file ?

Thanks

i messaged you, as I’m sure you’ll see. : )

Hi, Tonight, I tried to install openfoodnetwork package from github without ansible, then the application is running in port 3000. I can create an enterprise.
Only the email problem still exist.
Then there is something wrong on the ansible playbook which is not setup but I don’t know what

Interesting to hear that it’s working when set up without ansible. If it’s running on port 3000, then it sounds like it’s running the development web server, which is not suitable for the public to use.

Have you had any luck configuring bugsnag? I noticed yesterday that ansible puts the configuration file in the wrong place by default. It should be located at config/initializers/bugsnag.rb. Could you check that that’s set up correctly and give it another shot with unicorn/nginx? Hopefully that’ll log the error to bugsnag and we’ll be able to debug it from there.

Cheers,
Rohan

1 Like

Okay. I’m futzing around with bugsnag now. Tried running bundle exec rails generate bugsnag my_key but getting “Could not find generator bugsnag”. I’ll track down to bugsnag.rb file and put it in the right place…

it’s in ./config/bugsnag.rb

moved:

vagrant@vagrant-ubuntu-precise-64:~/apps/pcolacoop/current$ cat config/initializers/bugsnag.rb 
Bugsnag.configure do |config|
  config.api_key = "my_key"
  config.notify_release_stages = %w(production staging)
  config.use_ssl = true
end


Still getting:

vagrant@vagrant-ubuntu-precise-64:~/apps/pcolacoop/current$ tail -10 log/test.log 
   (0.2ms)  SELECT COUNT(*) FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama')
  Spree::State Load (0.2ms)  SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama') ORDER BY name ASC LIMIT 1
   (0.2ms)  SELECT COUNT(*) FROM "enterprises" WHERE "enterprises"."name" = ''
  CACHE (0.0ms)  SELECT "spree_countries".* FROM "spree_countries" WHERE "spree_countries"."id" = 49 LIMIT 1
  CACHE (0.0ms)  SELECT COUNT(*) FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama')
  CACHE (0.0ms)  SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama') ORDER BY name ASC LIMIT 1
  Enterprise Exists (0.2ms)  SELECT 1 AS one FROM "enterprises" WHERE "enterprises"."permalink" = 'my-enterprise' LIMIT 1
   (0.2ms)  ROLLBACK
Completed 500 Internal Server Error in 264.9ms
** [Bugsnag] No API key configured, couldn't notify
vagrant@vagrant-ubuntu-precise-64:~/apps/pcolacoop/current$ ls -l log/
total 396
-rw-rw-r-- 1 vagrant vagrant     66 Sep 25 02:28 delayed_job.log
-rw-rw-r-- 1 vagrant vagrant 133791 Sep 25 03:14 development.log
-rw-rw-r-- 1 vagrant vagrant  50248 Sep 25 03:14 newrelic_agent.log
-rw-rw-r-- 1 vagrant vagrant 203326 Sep 25 03:15 test.log
vagrant@vagrant-ubuntu-precise-64:~/apps/pcolacoop/current$ date
Fri Sep 25 03:16:44 UTC 2015

Changed the bugsnag content:

Bugsnag.configure do |config|
  config.api_key = "the_key_again"
  config.notify_release_stages = %w(production staging development)
  config.use_ssl = false
end

Restarting Rails server again…

Same. Vagrant Reload…

Also had wrong permissions on bugsnag file (775 or something):

chmod 664 config/initializers/bugsnag.rb 

We;re getting somewhere!

  Enterprise Exists (0.2ms)  SELECT 1 AS one FROM "enterprises" WHERE "enterprises"."permalink" = 'my-enterprise' LIMIT 1
   (0.1ms)  ROLLBACK
Completed 500 Internal Server Error in 501.0ms

Well. This logged an error in bugsnag: $ rake bugsnag:test_exception, But the 500 error doesn’t seem to have.

Cool, sounds like progress. What environment is the server running in? I know for some reason the default for the ansible scripts was to set the server to run in the test environment, which makes no sense, and also would stop bugsnag from reporting errors. It looks like that might be the case, since the logs are appearing in log/test.log. Could you try setting it up in development instead? The easiest way to do that might be to re-run the provisioning with rails_env set to development in vars.yml.

Alternatively, for a quick test, you could try putting “test” in the bugsnag notify_release_stages var.

I’ll start by adding test to the notify_release_stages var. Do you need to restart nginx and/or unicorn for the bugsnag config changes to take effect?

I’m not 100%, but I reckon you’ll need to restart unicorn (service unicorn_openfoodnetwork restart). I don’t think you’ll need to restart nginx.

OK. I had just done vagrant reload, but will try that next time. Looks like some new (and prosaic) output in the log file now: http://pastebin.com/Y24FSqJj

Nothing in bugsnag console yet though…

Hey in the non-test environment (with rails_env set to development in vars.yml) we get further! There was first a page with message about missing fields. Then:

404 not found on

http://127.0.0.1/admin/enterprises/professor-plumbs-biodynamic-truffles/edit

I know I didn’t chose a very creative test name. : )

I see what the problem is, though. We’re losing the port in the url. Should be:

http://127.0.0.1:8080/admin/enterprises/professor-plumbs-biodynamic-truffles/edit

I’m not sure how to get around this. Interestingly, when I start the rails server it says:

Rails 3.2.21 application starting in development on http://0.0.0.0:3000

The 8080 of course is set in the Vagrant file. Any recommendations? Maybe I could make a setting in the host computers /etc/hosts file, but it seems like there might be a more “elegant” approach.

Hi,
On my side, now bugsnag is activated on the server :
** [Bugsnag] Bugsnag
exception handler 1.5.2 ready, api_key=

But the servr can’t register error on bugnsag :
** [Bugsnag] Notifying https://notify.bugsnag.com of WebMock::NetConnectNotAllowedError from api_key

I check the key and it’s the key I can see from bugsnag website.

On the test.log file, i have the bugsnag messages. You can download the test.log with errors here http://testfrofn.cloudapp.net/vmaztstofnapp2.20150925.test.log

Hope that will help you to find the issue.

Hi guys - not sure if rohan mentioned that he’s away again for 10 days, but then he’s really back. @maikel may have some ideas on this but poss. not til next week - so silence is not forgotten / ignoring just significant resource limitations!!

OK. Thank you very much for the heads up. Have a nice weekend. More soon. : )

Interesting. It looks like the rails application is not allowed to make web requests. I’m wondering if that could be because of the environment. Try staging or production.

1 Like

Hi, I try to install production with ansible, then now I’m able to create enterprise but email is not sent.
From email configuration panel, I can send test email.

About email confirmation, I just see this message : “translation missing: fr.devise.enterprise_confirmations.enterprise.confirmation_sent” but no error.

Hi, Did you get some time to analyze this issue ?

Thanks a lot