<p>Brad's comment above helped us find the solution.  I had been looking at the <code>craft.log</code> file in the control panel at <code>/admin/utils</code> and it doesn't output the stack trace.  Look at the actual log file, we got more info on the issue which was that the ajax call was returning:</p>

<pre><code>[status code] 401
[reason phrase] Unauthorized
</code></pre>

<p>The plugin on the site we have was trying to render a front-end template using Guzzle and the dev site is password protected, and the request was not making it through.</p>

<p>Possible solutions include:</p>

<ol>
<li>Updating the way the template is being processed to not require a front-end request</li>
<li>Only use this functionality in locations that are not password protected</li>
<li>Hurry up and finish the massive overhaul of the plugin you are working on so this issue doesn't exist any longer!</li>
</ol>

<p>#3 it is!</p>

CC BY-SA 3.0
2015-01-21T04:21:19.973Z
2015-01-21T04:26:52.847Z
2015-01-21T04:26:52.847Z
Ben Parizek
<p>We have a plugin. Locally, it's working as expected.</p>

<p>When we push to dev, one of the actions begins to throw a 500 error.</p>

<p>The action is taking place via an ajax call, and the error in the console is:</p>

<pre><code>POST http://website.com/admin/pluginName/controller/method 500 (Internal Server Error)
</code></pre>

<p>If I expand that error in the console, I see the following:</p>

<pre><code>k.cors.a.crossDomain.send jquery-2.1.1.min.js?d=1421398025:4 
n.extend.ajax             jquery-2.1.1.min.js?d=1421398025:4 
n.(anonymous function)    controller:474 
(anonymous function)      jquery-2.1.1.min.js?d=1421398025:3 
n.event.dispatch          jquery-2.1.1.min.js?d=1421398025:3 
r.handle                  jquery-2.1.1.min.js?x=Q4rOzOLw2:3
</code></pre>

<p>Checking the Craft Error Logs I see:</p>

<pre><code>Level: error
Category: exception.Guzzle\Http\Exception\ClientErrorResponseException
Message exception: 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response
</code></pre>

<p>Any ideas on what is different about our dev environment vs. the local environment?  </p>

<p>Any steps I can take to better diagnose how to solve this issue?</p>

CC BY-SA 3.0
2015-01-20T23:26:03.713Z
Is there any stack trace with the error in the logs?
Brad Bell
<plugin-development><error-message>
Controller action throws a 500 error in some environments
# Controller action throws a 500 error in some environments

(Asked by: username_0 on 2015-01-20)

We have a plugin. Locally, it's working as expected.
When we push to dev, one of the actions begins to throw a 500 error.
The action is taking place via an ajax call, and the error in the console is:
POST http://website.com/admin/pluginName/controller/method 500 (Internal Server Error)

If I expand that error in the console, I see the following:
k.cors.a.crossDomain.send jquery-2.1.1.min.js?d=1421398025:4 
n.extend.ajax             jquery-2.1.1.min.js?d=1421398025:4 
n.(anonymous function)    controller:474 
(anonymous function)      jquery-2.1.1.min.js?d=1421398025:3 
n.event.dispatch          jquery-2.1.1.min.js?d=1421398025:3 
r.handle                  jquery-2.1.1.min.js?x=Q4rOzOLw2:3

Checking the Craft Error Logs I see:
Level: error
Category: exception.Guzzle\Http\Exception\ClientErrorResponseException
Message exception: 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response

Any ideas on what is different about our dev environment vs. the local environment?  
Any steps I can take to better diagnose how to solve this issue?

**Tags:** plugin-development, error-message
> **Comments:**
> **username_1**: Is there any stack trace with the error in the logs?  

---

## 1 answers

### Answer by username_0 on 2015-01-21. Score: 3

Brad's comment above helped us find the solution.  I had been looking at the craft.log file in the control panel at /admin/utils and it doesn't output the stack trace.  Look at the actual log file, we got more info on the issue which was that the ajax call was returning:
[status code] 401
[reason phrase] Unauthorized

The plugin on the site we have was trying to render a front-end template using Guzzle and the dev site is password protected, and the request was not making it through.
Possible solutions include:

Updating the way the template is being processed to not require a front-end request
Only use this functionality in locations that are not password protected
Hurry up and finish the massive overhaul of the plugin you are working on so this issue doesn't exist any longer!

#3 it is!


---

