couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <m...@hahnca.com>
Subject new ReferenceError(options is not defined)
Date Mon, 30 Jan 2012 22:29:17 GMT
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?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message