Skip to content

Instantly share code, notes, and snippets.

@cboulanger
Created November 16, 2020 16:47
Show Gist options
  • Save cboulanger/9c408f808ae5f8d3d9854f14faef2e54 to your computer and use it in GitHub Desktop.
Save cboulanger/9c408f808ae5f8d3d9854f14faef2e54 to your computer and use it in GitHub Desktop.
zotero-cli items --filter '{"q":"allison"}'
Command execution failed: StatusCodeError: 404 - {"type":"Buffer","data":[78,111,116,32,102,111,117,110,100]}
at new StatusCodeError (/Users/cboulanger/Code/zotero-cli/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/Users/cboulanger/Code/zotero-cli/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/Users/cboulanger/Code/zotero-cli/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/Users/cboulanger/Code/zotero-cli/node_modules/request/request.js:185:22)
at Request.emit (events.js:311:20)
at Request.<anonymous> (/Users/cboulanger/Code/zotero-cli/node_modules/request/request.js:1154:10)
at Request.emit (events.js:311:20)
at IncomingMessage.<anonymous> (/Users/cboulanger/Code/zotero-cli/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:417:28)
at IncomingMessage.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
name: 'StatusCodeError',
statusCode: 404,
message: '404 - {"type":"Buffer","data":[78,111,116,32,102,111,117,110,100]}',
error: <Buffer 4e 6f 74 20 66 6f 75 6e 64>,
options: {
uri: 'https://api.zotero.org/users/2571954/items?q=allison',
headers: {
'User-Agent': 'Zotero-CLI',
'Zotero-API-Version': '3',
'Zotero-API-Key': 'b7q0ariAIp5VhZjSCXPwD5BL'
},
encoding: null,
json: true,
resolveWithFullResponse: true,
callback: [Function: RP$callback],
transform: undefined,
simple: true,
transform2xxOnly: false
},
response: IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
readable: false,
_events: [Object: null prototype] {
end: [Array],
close: [Array],
data: [Function],
error: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.zotero.org',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api.zotero.org',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 6,
[Symbol(kHandle)]: null,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 255,
[Symbol(kBytesWritten)]: 203,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.zotero.org',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api.zotero.org',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 6,
[Symbol(kHandle)]: null,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 255,
[Symbol(kBytesWritten)]: 203,
[Symbol(connect-options)]: [Object]
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: {
date: 'Mon, 16 Nov 2020 16:43:37 GMT',
server: 'Apache/2.4.46 (Amazon)',
'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
'content-length': '9',
connection: 'close',
'content-type': 'text/html; charset=UTF-8'
},
rawHeaders: [
'Date',
'Mon, 16 Nov 2020 16:43:37 GMT',
'Server',
'Apache/2.4.46 (Amazon)',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains; preload',
'Content-Length',
'9',
'Connection',
'close',
'Content-Type',
'text/html; charset=UTF-8'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 404,
statusMessage: 'Not Found',
client: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.zotero.org',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api.zotero.org',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 6,
[Symbol(kHandle)]: null,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 255,
[Symbol(kBytesWritten)]: 203,
[Symbol(connect-options)]: [Object]
},
_consuming: false,
_dumped: false,
req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'GET /users/2571954/items?q=allison HTTP/1.1\r\n' +
'User-Agent: Zotero-CLI\r\n' +
'Zotero-API-Version: 3\r\n' +
'Zotero-API-Key: b7q0ariAIp5VhZjSCXPwD5BL\r\n' +
'host: api.zotero.org\r\n' +
'accept: application/json\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/users/2571954/items?q=allison',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
request: Request {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
uri: [Url],
headers: [Object],
encoding: null,
resolveWithFullResponse: true,
readable: true,
writable: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Promise [Object]],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
method: 'GET',
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'api.zotero.org',
path: '/users/2571954/items?q=allison',
_json: true,
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://api.zotero.org/users/2571954/items?q=allison',
req: [ClientRequest],
ntick: true,
response: [Circular],
originalHost: 'api.zotero.org',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true,
[Symbol(kCapture)]: false
},
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: <Buffer 4e 6f 74 20 66 6f 75 6e 64>,
[Symbol(kCapture)]: false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment