# Drizzle-nginx-module error body missing?

**URL:** <https://www.ruby-forum.com/t/drizzle-nginx-module-error-body-missing/212864>\
**Category:** NGINX\
**Created:** [October 16, 2011, 7:01am UTC](https://www.ruby-forum.com/t/drizzle-nginx-module-error-body-missing/212864 "2011-10-16T07:01:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [October 16, 2011, 7:01am UTC](https://www.ruby-forum.com/t/drizzle-nginx-module-error-body-missing/212864/1 "2011-10-16T07:01:39Z")

</div>

Hey nginx list, it’s been awhile. This question is directed at agentzh  
and chaoslawful.

I’m using nginx drizzle to insert to a table. I have a unique key  
constraint on the table. When I try to insert and violate the unique  
constraint, I get a 500 from the nginx location doing the mysql query,  
but no response body or headers to pass on to my client indicating what  
the mysql error was. I can easily check for the 500 in the location  
calling the mysql location, but I’d like to pass on the error code to  
the actual client with some useful error information and not mask any  
further 500’s.

The json-ified output of a successful insert has an errcode field:  
{“errcode”:0,“insert\_id”:1,“affected\_rows”:1}

, but an actual error returns an empty body. Is there no way to grab the  
error relating to my failed insert? Any suggestions?

Here’s the error log:  
2011/10/16 04:08:53 [error] 2847#0: \*60 failed to send query: 17 (1062):  
Duplicate entry ‘2-200-6094279b20’ for key ‘id\_versions’ while sending  
query to drizzle upstream, client: 10.102.17.232, server: , request:  
“POST [http://foo/v1/publish](http://foo/v1/publish) HTTP/1.1”, subrequest: “/mysql”, upstream:  
“drizzle://10.102.17.232:3306”, host: “foo”

Here’s the location:  
location /mysql {  
internal;  
drizzle\_pass mysqldb;  
drizzle\_module\_header off;  
set\_unescape\_uri $mysql\_query $query\_string;  
drizzle\_query $mysql\_query;  
rds\_json on;  
}

Here’s the query I’m sending lua and proven via ngx.say(query)  
INSERT INTO published SET packages\_id=(SELECT id FROM packages WHERE  
name=‘infra-package’), sha=‘6094279b2033a9dfa8bd38cadffeb9d274657936’,  
version=‘200’, path=‘678459e1ce’;

location /addpackage {  
internal;  
content\_by\_lua "

```
  local query = <bunch of query building code>

  local res = ngx.location.capture('/mysql', { args = query} )
  ngx.say(res.status..query)
  ngx.say(res.status)

```

}

ngx\_openresty/1.0.6.22

configure  
arguments:  
–prefix=/usr/local/encap/nginx-resty-1.0.6.22/nginx  
–add-module=…/ngx\_devel\_kit-0.2.17  
–add-module=…/echo-nginx-module-0.37rc4  
–add-module=…/xss-nginx-module-0.03rc3  
–add-module=…/set-misc-nginx-module-0.22rc2  
–add-module=…/form-input-nginx-module-0.07rc5  
–add-module=…/encrypted-session-nginx-module-0.01  
–add-module=…/drizzle-nginx-module-0.1.1  
–add-module=…/ngx\_lua-0.3.1rc8  
–add-module=…/headers-more-nginx-module-0.16rc2  
–add-module=…/srcache-nginx-module-0.12  
–add-module=…/array-var-nginx-module-0.03rc1  
–add-module=…/memc-nginx-module-0.12  
–add-module=…/redis2-nginx-module-0.07  
–add-module=…/upstream-keepalive-nginx-module-0.3  
–add-module=…/auth-request-nginx-module-0.2  
–add-module=…/rds-json-nginx-module-0.12rc5  
–add-module=…/rds-csv-nginx-module-0.03  
–add-module=/foursquare/david/src/third-party/nginx-gridfs  
–add-module=/foursquare/david/src/third-party/nginx\_upload\_module-2.2.0  
–with-http\_ssl\_module

Posted at Nginx Forum:

> **[drizzle-nginx-module error body missing?](https://forum.nginx.org/read.php?2,216768,216768#msg-216768)**
>
> Hey nginx list, it's been awhile. This question is directed at agentzh and chaoslawful. I'm using nginx drizzle to insert to a table. I have a unique key constraint on the table. When I try to insert and violate the unique constraint, I get a 500...

---

<div class="post-metadata">

**Author:** ![dannynoonan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dannynoonan](https://www.ruby-forum.com/u/dannynoonan)\
**Post date:** [October 16, 2011, 7:13am UTC](https://www.ruby-forum.com/t/drizzle-nginx-module-error-body-missing/212864/2 "2011-10-16T07:13:21Z")

</div>

On Sun, Oct 16, 2011 at 1:00 PM, dannynoonan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’m using nginx drizzle to insert to a table. I have a unique key  
> constraint on the table. When I try to insert and violate the unique  
> constraint, I get a 500 from the nginx location doing the mysql query,  
> but no response body or headers to pass on to my client indicating what  
> the mysql error was. I can easily check for the 500 in the location  
> calling the mysql location, but I’d like to pass on the error code to  
> the actual client with some useful error information and not mask any  
> further 500’s.

I’ll add a new directive named drizzle\_outptu\_errors to control  
whether to return the underlying error code and error string in the  
RDS output in the next few days or so.

Thank you for reminding me of this missing feature 🙂

Thanks!  
-agentzh

---

<div class="post-metadata">

**Author:** ![dannynoonan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@dannynoonan](https://www.ruby-forum.com/u/dannynoonan)\
**Post date:** [October 16, 2011, 7:24am UTC](https://www.ruby-forum.com/t/drizzle-nginx-module-error-body-missing/212864/3 "2011-10-16T07:24:29Z")

</div>

awesome, thanks!

Posted at Nginx Forum:

> **[Re: drizzle-nginx-module error body missing?](https://forum.nginx.org/read.php?2,216768,216770#msg-216770)**
>
> Hey nginx list, it's been awhile. This question is directed at agentzh and chaoslawful. I'm using nginx drizzle to insert to a table. I have a unique key constraint on the table. When I try to insert and violate the unique constraint, I get a 500...
