From user-return-19714-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Feb 1 03:17:41 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 52EEA96B5 for ; Wed, 1 Feb 2012 03:17:41 +0000 (UTC) Received: (qmail 15848 invoked by uid 500); 1 Feb 2012 03:17:39 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 15324 invoked by uid 500); 1 Feb 2012 03:17:18 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 15312 invoked by uid 99); 1 Feb 2012 03:17:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2012 03:17:14 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2012 03:17:08 +0000 Received: by vbih1 with SMTP id h1so876916vbi.11 for ; Tue, 31 Jan 2012 19:16:48 -0800 (PST) Received: by 10.52.33.68 with SMTP id p4mr11927693vdi.52.1328066208145; Tue, 31 Jan 2012 19:16:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.117.205 with HTTP; Tue, 31 Jan 2012 19:16:28 -0800 (PST) In-Reply-To: References: From: Jason Smith Date: Wed, 1 Feb 2012 10:16:28 +0700 Message-ID: Subject: Re: new ReferenceError(options is not defined) To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Mark, do you have a validate_doc_update function with any mention of an "options" label? I haven't scrutinized your writeup but I suspect the "options" part of your node code is a red herring. Is there a chance you use a bad variable name in the validator? On Wed, Feb 1, 2012 at 7:01 AM, Mark Hahn wrote: > Thank you very much. =C2=A0I will look at it with wireshark. > > On Tue, Jan 31, 2012 at 3:39 PM, CGS wrote: > >> I don't know what you did there, but it seems there is an interaction in >> between node and couch in which couch catches 'new ReferenceError(option= s >> is not defined)' (it may be that node returns this error to couch via JS= , >> but really no idea because I don't know what you did there). From the >> error, Erlang catches a JS engine error which is reported that way. How = and >> where, I don't know without more info. >> >> The first part of the error: >> >> [error] [<0.7533.1>] OS Process Error <0.7546.1> :: {<<"unnamed_error">>= , >> >> suggested the error caught by Erlang from JS engine, while the second pa= rt: >> >> <<"(new ReferenceError(\"options is not defined\", \"\"))">>} >> >> is the JS engine report for that error (which is translated like: "the >> 'options' variable/element... is not defined", meaning, either something >> happened within that variable which provoked the crash, or the variable = is >> not recognized by the environment). From what you gave us, the only plac= e >> containing "options" variable is line 6 from your node code. That's why = I >> made that connection. If you have somewhere else "options", there are >> chances that there could be the problem. But, as I said, more than >> interpreting the error, I cannot say for sure it's like that because I h= ave >> no idea what you did there and, more than that, I don't know node. >> >> Sorry, but more than that I am not able to help you with my knowledge in >> this moment. If that is not enough info, please, accept my apologies for >> interfering. >> >> CGS >> >> >> >> >> On Tue, Jan 31, 2012 at 11:57 PM, Mark Hahn wrote: >> >> > How did the couch error message know the word "options"? =C2=A0My use = of the >> > word options is for the specific node call http.request. >> > >> > BTW: thanks for the help. =C2=A0I'm sure I'm doing something stupid. >> > >> > On Tue, Jan 31, 2012 at 2:48 PM, CGS wrote: >> > >> > > At line 6 from your node code snippet you defined variable "options"= : >> > > >> > > options =3D {host: 'localhost', port: mh.dbPort, method: 'PUT', head= ers, >> > > path: dbPath} >> > > >> > > My toss of dices would go in the definition of the headers, but that= 's >> > just >> > > a wild guess. >> > > >> > > CGS >> > > >> > > >> > > >> > > On Tue, Jan 31, 2012 at 11:30 PM, Mark Hahn wrote: >> > > >> > > > I'm not familiar with the options you are talking about. =C2=A0Are= these >> > some >> > > > kind of http options or couchdb options in the json body? >> > > > >> > > > On Tue, Jan 31, 2012 at 2:16 PM, CGS wrote: >> > > > >> > > > > Hi Mark, >> > > > > >> > > > > It looks very much like an JS engine error and it seems there is= a >> > > > problem >> > > > > in setting up the "options" parameter. From the error, either >> > "options" >> > > > > parameter doesn't exist, or it is not well formatted (no idea ab= out >> > > > > node.js). Another option is an incompatibility with JS engine >> version >> > > > which >> > > > > doesn't accept your "options" in that format. >> > > > > >> > > > > I would suggest to ask about what's wrong with your "options" se= tup >> > > (and >> > > > JS >> > > > > engine compatibility if nothing is wrong) in node.js mailing >> > list/forum >> > > > or >> > > > > wait here for someone who knows node.js enough to see where you >> went >> > > > wrong >> > > > > there. Definitely the error is there, but I cannot tell you what >> as I >> > > > have >> > > > > no idea about node.js (as I said it before). >> > > > > >> > > > > I hope this post will help you at least as a starting point in >> > > debugging. >> > > > > >> > > > > CGS >> > > > > >> > > > > >> > > > > >> > > > > >> > > > > On Tue, Jan 31, 2012 at 10:00 PM, Mark Hahn >> wrote: >> > > > > >> > > > > > I'm bumping this because it is killing me. =C2=A0I can't get p= ast this >> > > > > problem. >> > > > > > =C2=A0It is happening several places in my code. >> > > > > > >> > > > > > What can cause an "OS Process Error"? >> > > > > > >> > > > > > On Mon, Jan 30, 2012 at 2:29 PM, Mark Hahn >> > wrote: >> > > > > > >> > > > > > > I'm getting this error on a put request for an attachment. >> > > > > > > >> > > > > > > =C2=A0 =C2=A0 [error] [<0.7533.1>] OS Process Error <0.7546.= 1> :: >> > > > > > > {<<"unnamed_error">>, >> > > > > > > =C2=A0 =C2=A0 <<"(new ReferenceError(\"options is not define= d\", >> \"\"))">>} >> > > > > > > >> > > > > > > This is my node code ... >> > > > > > > >> > > > > > > headers =3D {} >> > > > > > > headers.Authorization =C2=A0 =C2=A0 =3D mh.dbAuthHdr >> > > > > > > =C2=A0headers['content-type'] =C2=A0 =3D contentType >> > > > > > > headers['content-length'] =3D contentLength >> > > > > > > =C2=A0dbPath =3D '/ri/' + compDoc._id + '/' + attachmentName= + >> '?rev=3D' + >> > > > > > > compDoc._rev >> > > > > > > options =3D {host: 'localhost', port: mh.dbPort, method: 'PU= T', >> > > > headers, >> > > > > > > path: dbPath} >> > > > > > > >> > > > > > > respStr =3D '' >> > > > > > > resp =3D null >> > > > > > > readStream =3D fs.createReadStream filePath >> > > > > > > =C2=A0readStream.on 'error', (e) -> >> > > > > > > vh.err req, res, 'um: uploadAttachment read error ' + >> compDoc._id >> > > + ' >> > > > > ' + >> > > > > > > e.message, 500 >> > > > > > > =C2=A0readStream.pipe http.request options, (resProx) -> >> > > > > > > if +resProx.statusCode isnt 201 >> > > > > > > =C2=A0vh.err req, res, >> > > > > > > 'um: uploadAttachment db request err ' + compDoc._id + ' ' + >> > > > > > > resProx.statusCode, 500 >> > > > > > > =C2=A0return >> > > > > > > resProx.on 'data', (chunk) -> respStr +=3D chunk.toString() >> > > > > > > =C2=A0resProx.on 'end', (chunk) -> >> > > > > > > if chunk then respStr +=3D chunk.toString() >> > > > > > > =C2=A0resp =3D JSON.parse respStr >> > > > > > > docUpdate =3D procThumbnails: compDoc.procThumbnails >> > > > > > > =C2=A0if lastUpdate then docUpdate.needsNotification =3D yes >> > > > > > > db.updateDoc compDoc._id, docUpdate, (err, doc) -> >> > > > > > > =C2=A0if err >> > > > > > > log 'dba: uploadAttachment compDoc update err ' + compDoc._i= d >> > > > > > > =C2=A0cb false >> > > > > > > return >> > > > > > > compDoc =3D doc >> > > > > > > =C2=A0callback true >> > > > > > > >> > > > > > > This is the value of my options ... >> > > > > > > >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0host: localhost >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0path: >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> /ri/04b7c4eb50d1d01dbb1a0f097bb80/thumbnail-72x48c.jpg?rev=3D27-3d44ae70= 8d6fe9c835577d71f5e70359 >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0method: PUT >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0headers: >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 content-length: 3511 >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 content-type: image/jpeg >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Authorization: Basic ... snipped ... >> > > > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0port: 5984 >> > > > > > > >> > > > > > > Does anyone have an idea of what I'm doing wrong? >> > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> --=20 Iris Couch