pouchdb: Error 500 with CORS warning
I am getting repetitive 500 errors (v5.1.0) and would appreciate some guidance on how to debug further.
Uncaught (in promise) e
error: true
message: "Database encountered an unknown error"
name: "unknown_error"
result: Object
doc_write_failures: 0
docs_read: 0
docs_written: 0
end_time: Tue Dec 08 2015 21:00:53 GMT+0200 (SAST)
errors: Array[1]...
ok: false
start_time: Tue Dec 08 2015 20:14:09 GMT+0200 (SAST)
status: "aborting"
status: 50
followed by a warning
PouchDB: the remote database may not have CORS enabled.If not please enable CORS: http://pouchdb.com/errors.html#no_access_control_allow_origin_header
but I definitely have cors enabled
curl --user XXX:XXX xxxx.cloudant.com/_api/v2/user/config/cors
{
"enable_cors": true,
"allow_credentials": true,
"origins": [
"*"
]
}
this happens periodically, but especially when offline. I am canceling the sync as follows when offline is detected:
// on startup / online detected:
sync.company = db.sync(companyUrl, {live: true, retry: true})...
// if offline detected
console.log('offline detected - stopping sync');
if (sync.company) sync.company.cancel();
but am also seeing this error
offline detected - stopping sync
TypeError: o.company.cancel is not a function
at e (vendor.js:62)
at Object.fn (vendor.js:62)
at n.$digest (vendor.js:5)
at n.$apply (vendor.js:5)
(code has been minified)
inspecting the sync.company
object i see it is a promise… but the docs show that you should be able to call cancel() ??
http://pouchdb.com/api.html#sync
not sure if the sync cancel is in any way related to the 500 error, but thought it would be worth mentioning
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 38 (8 by maintainers)
Gentle reminder: “me too”, “+1”, etc. does not get the issue resolved any faster. What does: providing a reproducible test case. E.g. a minimal Cordova project that reproduces the bug.
@ronyrun No, you cannot. We didn’t plan for the case where simply doing the request would cause a modal popup to appear.