Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

502 Bad Gateway error on Azure website

Im currently integrating a new Payment system (Trustly) into my website. This involves sending a jsonstring to Trustlys server. This code is working perfectly locally, but on my testing environment on azure i get a 502 bad gateway error. Whats wierd is the app seems to break inside a try block, yet the following catch block does not fire. Consider this code:

        var postData = PrepJsonForTrustly(someSecretData);

        try
        {
            _logger.Info("attempting Deposit to trustly");  //this shows up in my logs
            var res = _client.Deposit(postData);
            _logger.Info("TrustlyDeposit successful"); //this doesn't
            return res;
        }
        catch (Exception ex)
        {
            _logger.Info("Failed Deposit to Trustly"); //and, oddly, neither does this!
            throw ex;
        }

Googleing the issue I found this http://blog.wouldbetheologian.com/2014/07/502-bad-gateway-error-on-azure-websites.html

Which seems to describe most of the same symtoms, except my code works perfectly on localhost, the stackoverflowexception he describes would have crashed my local server too.

Any Ideas what may be causing this? Or why my catch-block isn't firing?

like image 382
Anders Martini Avatar asked Mar 16 '23 05:03

Anders Martini


1 Answers

A possible explanation of missing logs would be if the process crashes. Have you checked eventlog.xml file (in the logFiles folder) - this is the file that write the application event log.

like image 106
Galin Iliev Avatar answered Apr 01 '23 07:04

Galin Iliev