You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by CGS <cg...@gmail.com> on 2012/02/01 00:39:01 UTC

Re: new ReferenceError(options is not defined)

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(options
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 part:

<<"(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 place
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 have
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 <ma...@hahnca.com> wrote:

> How did the couch error message know the word "options"?  My use of the
> word options is for the specific node call http.request.
>
> BTW: thanks for the help.  I'm sure I'm doing something stupid.
>
> On Tue, Jan 31, 2012 at 2:48 PM, CGS <cg...@gmail.com> wrote:
>
> > At line 6 from your node code snippet you defined variable "options":
> >
> > options = {host: 'localhost', port: mh.dbPort, method: 'PUT', headers,
> > 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 <ma...@hahnca.com> wrote:
> >
> > > I'm not familiar with the options you are talking about.  Are these
> some
> > > kind of http options or couchdb options in the json body?
> > >
> > > On Tue, Jan 31, 2012 at 2:16 PM, CGS <cg...@gmail.com> 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 about
> > > > 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" setup
> > (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 <ma...@hahnca.com> wrote:
> > > >
> > > > > I'm bumping this because it is killing me.  I can't get past this
> > > > problem.
> > > > >  It 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 <ma...@hahnca.com>
> wrote:
> > > > >
> > > > > > I'm getting this error on a put request for an attachment.
> > > > > >
> > > > > >     [error] [<0.7533.1>] OS Process Error <0.7546.1> ::
> > > > > > {<<"unnamed_error">>,
> > > > > >     <<"(new ReferenceError(\"options is not defined\", \"\"))">>}
> > > > > >
> > > > > > This is my node code ...
> > > > > >
> > > > > > headers = {}
> > > > > > headers.Authorization     = mh.dbAuthHdr
> > > > > >  headers['content-type']   = contentType
> > > > > > headers['content-length'] = contentLength
> > > > > >  dbPath = '/ri/' + compDoc._id + '/' + attachmentName + '?rev=' +
> > > > > > compDoc._rev
> > > > > > options = {host: 'localhost', port: mh.dbPort, method: 'PUT',
> > > headers,
> > > > > > path: dbPath}
> > > > > >
> > > > > > respStr = ''
> > > > > > resp = null
> > > > > > readStream = fs.createReadStream filePath
> > > > > >  readStream.on 'error', (e) ->
> > > > > > vh.err req, res, 'um: uploadAttachment read error ' + compDoc._id
> > + '
> > > > ' +
> > > > > > e.message, 500
> > > > > >  readStream.pipe http.request options, (resProx) ->
> > > > > > if +resProx.statusCode isnt 201
> > > > > >  vh.err req, res,
> > > > > > 'um: uploadAttachment db request err ' + compDoc._id + ' ' +
> > > > > > resProx.statusCode, 500
> > > > > >  return
> > > > > > resProx.on 'data', (chunk) -> respStr += chunk.toString()
> > > > > >  resProx.on 'end', (chunk) ->
> > > > > > if chunk then respStr += chunk.toString()
> > > > > >  resp = JSON.parse respStr
> > > > > > docUpdate = procThumbnails: compDoc.procThumbnails
> > > > > >  if lastUpdate then docUpdate.needsNotification = yes
> > > > > > db.updateDoc compDoc._id, docUpdate, (err, doc) ->
> > > > > >  if err
> > > > > > log 'dba: uploadAttachment compDoc update err ' + compDoc._id
> > > > > >  cb false
> > > > > > return
> > > > > > compDoc = doc
> > > > > >  callback true
> > > > > >
> > > > > > This is the value of my options ...
> > > > > >
> > > > > >          host: <string> localhost
> > > > > >          path: <string>
> > > > > >
> > > > >
> > > >
> > >
> >
> /ri/04b7c4eb50d1d01dbb1a0f097bb80/thumbnail-72x48c.jpg?rev=27-3d44ae708d6fe9c835577d71f5e70359
> > > > > >          method: <string> PUT
> > > > > >          headers:
> > > > > >             content-length: <number> 3511
> > > > > >             content-type: <string> image/jpeg
> > > > > >             Authorization: <string> Basic ... snipped ...
> > > > > >          port: <number> 5984
> > > > > >
> > > > > > Does anyone have an idea of what I'm doing wrong?
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: new ReferenceError(options is not defined)

Posted by Jason Smith <jh...@iriscouch.com>.
On Wed, Feb 1, 2012 at 10:38 AM, Mark Hahn <ma...@hahnca.com> wrote:
>>  do you have a validate_doc_update function with any mention of an
> "options" label?
>
> No, I don't.  I don't have anything named options in my db setup.
>
>>   I suspect the "options" part of your node code is a red herring.
>
> When I get a chance I'll test changing my variable name but I'm confident
> that the name is just a coincidence as you said.  I suspect it is some
> internal couch var.
>
> I emptied my db and that didn't help.  I went to the trouble to rebuild
> couch from scratch but it made no difference.
>
> The problem happens in two requests in my code and for now I've managed to
> disable them to get back to work.  The weird thing is that I can't find
> anything in common with the two places.  One is trying to add an attachment
> and the other is a _changes request.  Oh well ...

Interesting. Well, not to change the subject, but many people agree
that the "request" package is the better way to access CouchDB
(compared to the http module). In my opinion, nano, a thin layer on
top of request, is a great balance of flexibility and convenience.
Both are available via `npm install` and I've got a port of the
`request` API to the browser for good measure.

-- 
Iris Couch

Re: new ReferenceError(options is not defined)

Posted by Mark Hahn <ma...@hahnca.com>.
>  do you have a validate_doc_update function with any mention of an
"options" label?

No, I don't.  I don't have anything named options in my db setup.

>   I suspect the "options" part of your node code is a red herring.

When I get a chance I'll test changing my variable name but I'm confident
that the name is just a coincidence as you said.  I suspect it is some
internal couch var.

I emptied my db and that didn't help.  I went to the trouble to rebuild
couch from scratch but it made no difference.

The problem happens in two requests in my code and for now I've managed to
disable them to get back to work.  The weird thing is that I can't find
anything in common with the two places.  One is trying to add an attachment
and the other is a _changes request.  Oh well ...

Re: new ReferenceError(options is not defined)

Posted by Jason Smith <jh...@iriscouch.com>.
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 <ma...@hahnca.com> wrote:
> Thank you very much.  I will look at it with wireshark.
>
> On Tue, Jan 31, 2012 at 3:39 PM, CGS <cg...@gmail.com> 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(options
>> 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 part:
>>
>> <<"(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 place
>> 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 have
>> 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 <ma...@hahnca.com> wrote:
>>
>> > How did the couch error message know the word "options"?  My use of the
>> > word options is for the specific node call http.request.
>> >
>> > BTW: thanks for the help.  I'm sure I'm doing something stupid.
>> >
>> > On Tue, Jan 31, 2012 at 2:48 PM, CGS <cg...@gmail.com> wrote:
>> >
>> > > At line 6 from your node code snippet you defined variable "options":
>> > >
>> > > options = {host: 'localhost', port: mh.dbPort, method: 'PUT', headers,
>> > > 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 <ma...@hahnca.com> wrote:
>> > >
>> > > > I'm not familiar with the options you are talking about.  Are these
>> > some
>> > > > kind of http options or couchdb options in the json body?
>> > > >
>> > > > On Tue, Jan 31, 2012 at 2:16 PM, CGS <cg...@gmail.com> 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 about
>> > > > > 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" setup
>> > > (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 <ma...@hahnca.com>
>> wrote:
>> > > > >
>> > > > > > I'm bumping this because it is killing me.  I can't get past this
>> > > > > problem.
>> > > > > >  It 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 <ma...@hahnca.com>
>> > wrote:
>> > > > > >
>> > > > > > > I'm getting this error on a put request for an attachment.
>> > > > > > >
>> > > > > > >     [error] [<0.7533.1>] OS Process Error <0.7546.1> ::
>> > > > > > > {<<"unnamed_error">>,
>> > > > > > >     <<"(new ReferenceError(\"options is not defined\",
>> \"\"))">>}
>> > > > > > >
>> > > > > > > This is my node code ...
>> > > > > > >
>> > > > > > > headers = {}
>> > > > > > > headers.Authorization     = mh.dbAuthHdr
>> > > > > > >  headers['content-type']   = contentType
>> > > > > > > headers['content-length'] = contentLength
>> > > > > > >  dbPath = '/ri/' + compDoc._id + '/' + attachmentName +
>> '?rev=' +
>> > > > > > > compDoc._rev
>> > > > > > > options = {host: 'localhost', port: mh.dbPort, method: 'PUT',
>> > > > headers,
>> > > > > > > path: dbPath}
>> > > > > > >
>> > > > > > > respStr = ''
>> > > > > > > resp = null
>> > > > > > > readStream = fs.createReadStream filePath
>> > > > > > >  readStream.on 'error', (e) ->
>> > > > > > > vh.err req, res, 'um: uploadAttachment read error ' +
>> compDoc._id
>> > > + '
>> > > > > ' +
>> > > > > > > e.message, 500
>> > > > > > >  readStream.pipe http.request options, (resProx) ->
>> > > > > > > if +resProx.statusCode isnt 201
>> > > > > > >  vh.err req, res,
>> > > > > > > 'um: uploadAttachment db request err ' + compDoc._id + ' ' +
>> > > > > > > resProx.statusCode, 500
>> > > > > > >  return
>> > > > > > > resProx.on 'data', (chunk) -> respStr += chunk.toString()
>> > > > > > >  resProx.on 'end', (chunk) ->
>> > > > > > > if chunk then respStr += chunk.toString()
>> > > > > > >  resp = JSON.parse respStr
>> > > > > > > docUpdate = procThumbnails: compDoc.procThumbnails
>> > > > > > >  if lastUpdate then docUpdate.needsNotification = yes
>> > > > > > > db.updateDoc compDoc._id, docUpdate, (err, doc) ->
>> > > > > > >  if err
>> > > > > > > log 'dba: uploadAttachment compDoc update err ' + compDoc._id
>> > > > > > >  cb false
>> > > > > > > return
>> > > > > > > compDoc = doc
>> > > > > > >  callback true
>> > > > > > >
>> > > > > > > This is the value of my options ...
>> > > > > > >
>> > > > > > >          host: <string> localhost
>> > > > > > >          path: <string>
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> /ri/04b7c4eb50d1d01dbb1a0f097bb80/thumbnail-72x48c.jpg?rev=27-3d44ae708d6fe9c835577d71f5e70359
>> > > > > > >          method: <string> PUT
>> > > > > > >          headers:
>> > > > > > >             content-length: <number> 3511
>> > > > > > >             content-type: <string> image/jpeg
>> > > > > > >             Authorization: <string> Basic ... snipped ...
>> > > > > > >          port: <number> 5984
>> > > > > > >
>> > > > > > > Does anyone have an idea of what I'm doing wrong?
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>



-- 
Iris Couch

Re: new ReferenceError(options is not defined)

Posted by Mark Hahn <ma...@hahnca.com>.
Thank you very much.  I will look at it with wireshark.

On Tue, Jan 31, 2012 at 3:39 PM, CGS <cg...@gmail.com> 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(options
> 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 part:
>
> <<"(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 place
> 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 have
> 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 <ma...@hahnca.com> wrote:
>
> > How did the couch error message know the word "options"?  My use of the
> > word options is for the specific node call http.request.
> >
> > BTW: thanks for the help.  I'm sure I'm doing something stupid.
> >
> > On Tue, Jan 31, 2012 at 2:48 PM, CGS <cg...@gmail.com> wrote:
> >
> > > At line 6 from your node code snippet you defined variable "options":
> > >
> > > options = {host: 'localhost', port: mh.dbPort, method: 'PUT', headers,
> > > 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 <ma...@hahnca.com> wrote:
> > >
> > > > I'm not familiar with the options you are talking about.  Are these
> > some
> > > > kind of http options or couchdb options in the json body?
> > > >
> > > > On Tue, Jan 31, 2012 at 2:16 PM, CGS <cg...@gmail.com> 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 about
> > > > > 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" setup
> > > (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 <ma...@hahnca.com>
> wrote:
> > > > >
> > > > > > I'm bumping this because it is killing me.  I can't get past this
> > > > > problem.
> > > > > >  It 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 <ma...@hahnca.com>
> > wrote:
> > > > > >
> > > > > > > I'm getting this error on a put request for an attachment.
> > > > > > >
> > > > > > >     [error] [<0.7533.1>] OS Process Error <0.7546.1> ::
> > > > > > > {<<"unnamed_error">>,
> > > > > > >     <<"(new ReferenceError(\"options is not defined\",
> \"\"))">>}
> > > > > > >
> > > > > > > This is my node code ...
> > > > > > >
> > > > > > > headers = {}
> > > > > > > headers.Authorization     = mh.dbAuthHdr
> > > > > > >  headers['content-type']   = contentType
> > > > > > > headers['content-length'] = contentLength
> > > > > > >  dbPath = '/ri/' + compDoc._id + '/' + attachmentName +
> '?rev=' +
> > > > > > > compDoc._rev
> > > > > > > options = {host: 'localhost', port: mh.dbPort, method: 'PUT',
> > > > headers,
> > > > > > > path: dbPath}
> > > > > > >
> > > > > > > respStr = ''
> > > > > > > resp = null
> > > > > > > readStream = fs.createReadStream filePath
> > > > > > >  readStream.on 'error', (e) ->
> > > > > > > vh.err req, res, 'um: uploadAttachment read error ' +
> compDoc._id
> > > + '
> > > > > ' +
> > > > > > > e.message, 500
> > > > > > >  readStream.pipe http.request options, (resProx) ->
> > > > > > > if +resProx.statusCode isnt 201
> > > > > > >  vh.err req, res,
> > > > > > > 'um: uploadAttachment db request err ' + compDoc._id + ' ' +
> > > > > > > resProx.statusCode, 500
> > > > > > >  return
> > > > > > > resProx.on 'data', (chunk) -> respStr += chunk.toString()
> > > > > > >  resProx.on 'end', (chunk) ->
> > > > > > > if chunk then respStr += chunk.toString()
> > > > > > >  resp = JSON.parse respStr
> > > > > > > docUpdate = procThumbnails: compDoc.procThumbnails
> > > > > > >  if lastUpdate then docUpdate.needsNotification = yes
> > > > > > > db.updateDoc compDoc._id, docUpdate, (err, doc) ->
> > > > > > >  if err
> > > > > > > log 'dba: uploadAttachment compDoc update err ' + compDoc._id
> > > > > > >  cb false
> > > > > > > return
> > > > > > > compDoc = doc
> > > > > > >  callback true
> > > > > > >
> > > > > > > This is the value of my options ...
> > > > > > >
> > > > > > >          host: <string> localhost
> > > > > > >          path: <string>
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> /ri/04b7c4eb50d1d01dbb1a0f097bb80/thumbnail-72x48c.jpg?rev=27-3d44ae708d6fe9c835577d71f5e70359
> > > > > > >          method: <string> PUT
> > > > > > >          headers:
> > > > > > >             content-length: <number> 3511
> > > > > > >             content-type: <string> image/jpeg
> > > > > > >             Authorization: <string> Basic ... snipped ...
> > > > > > >          port: <number> 5984
> > > > > > >
> > > > > > > Does anyone have an idea of what I'm doing wrong?
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>