Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: xhr poll error #22

Open
beegmon opened this issue Oct 28, 2016 · 2 comments
Open

Error: xhr poll error #22

beegmon opened this issue Oct 28, 2016 · 2 comments

Comments

@beegmon
Copy link

beegmon commented Oct 28, 2016

Hello,

I am more than certain I am doing something dumb but I can't seem to figure out what my issue might be.

I have a pretty simply setup:

pouch_proxy.js -- proxies to couchDB (which has all auth turned off right now):
`
const socketPouchServer = require('socket-pouch/server');

socketPouchServer.listen(80, {remoteUrl: 'http://127.0.0.1:5984'}, function () {
console.log('PouchDB Proxy Started Pointed at LocalHost CouchDB');
});
`

pouch.js -- Client that a remoteDB and attempts grab all the docs from it:
`
const PouchDB = require('pouchdb');
PouchDB.adapter('socket', require('socket-pouch/client'));

const remoteDB = new PouchDB('new_gdax_limit_events', {
adapter: 'socket',
url: 'ws://127.0.0.1:80',
});

remoteDB.allDocs({
include_docs: true
}).then(function (result) {
console.log(result);
}).catch(function (err) {
console.log(err);
});
`

The resulting output from pouch.js is:
{ [Error: xhr poll error] type: 'TransportError', description: 503 }

Running pouch.js with debug gives me:
pouchdb:socket:client constructor called +0ms { adapter: 'socket', url: 'ws://127.0.0.1:80', name: '_pouch_new_gdax_limit_events' } { [Error: xhr poll error] type: 'TransportError', description: 503 }

When running pouch_proxy.js with debug I get no output.

Any hints as to what I might be doing wrong? I can connect to the couchDB on localhost:5984 and the DB being called by the client exists and is full of docs.

Thanks!

@beegmon
Copy link
Author

beegmon commented Oct 28, 2016

Update: I figured out the Xhr error (wasn't listening on the port I thought I was). However, now my client produces this message:

[root@centos pouch_test]# DEBUG=pouchdb:socket:* node pouch.js pouchdb:socket:client constructor called +0ms { adapter: 'socket', url: 'ws://localhost:80', name: '_pouch_new_gdax_limit_events' } pouchdb:socket:client socket opened +126ms PpoZW82qdZQA1y_lAAAG undefined pouchdb:socket:client send message +2ms PpoZW82qdZQA1y_lAAAG 533A8E28-0107-4AF9-9240-ED3D9DB4799F createDatabase [ { name: undefined, auto_compaction: false } ] pouchdb:socket:client message sent +4ms PpoZW82qdZQA1y_lAAAG 533A8E28-0107-4AF9-9240-ED3D9DB4799F pouchdb:socket:client receive message +68ms PpoZW82qdZQA1y_lAAAG 533A8E28-0107-4AF9-9240-ED3D9DB4799F 0 { error: 'you must provide a database name' } { error: 'you must provide a database name' }

@nolanlawson
Copy link
Member

Have you tried looking at the unit tests to see how they work? If you can get those running on your machine (which should be as easy as npm install and npm run dev) then you can confirm what code is necessary in order to get this module to work. Otherwise from looking at the information provided it's difficult for me to provide guidance...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants