-
Notifications
You must be signed in to change notification settings - Fork 53
[ios] intermittent CORS error #119
Comments
I have same issue ! |
sorry to hear you've been running into those issues. I've seen that a few times too but couldn't tell why. @cboden are you still seeing those errors? Since the app isn't running in a browser, I think we can rule out CORS as the root cause. |
Yup, we haven't released our app yet, we see this in development all day every day. I'm currently testing and seeing this on iOS. I will see this error mid-way through running the app; I'll do some queries, some inserts, at some point try to do another insert and get this error. |
Is the issue happening on Android as well or iOS only? I recently found out that the iOS Listener doesn't support OPTIONS requests which is something the browser would do when it sends a request to a different origin than the web server. But again, in the context of react native I don't know if it's relevant. |
Android is currently untested; we haven't ported it over yet. |
ok so it's likely to happen on iOS only at this stage and the error message is exactly the same as the Chrome logs from couchbase/couchbase-lite-ios#1709. The scenario is different (web app versus react native app) but it'll be good to try it again with the fix for 1709 to see if it makes any difference. |
Hi, im having the same issue, but it like 50% of UPDATE request. Does anyone has a solution or workaround? |
Hello, I am also facing this issue very frequently. @jamiltz, if I understand well your comment, this issue is related to couchbase-lite-ios library. Right ? Does it mean that it is not possible to make PUT http request to standard ios couchbase ? I wonder why this issue is still pending. Is it a feature only used by react-native plugin ? Best regards, |
I have added following function in CBL_Router+Handlers.m as suggested in couchbase/couchbase-lite-ios#1709 but it does not work:
Still have the same issue: { url: 'http://u72321505:p26009043@localhost:5984/booqee/Transaction%3A%3A1503528799142-e42983a1-8577-47fd-b2d2-13cf32ff198a', |
I can reproduce this bug reasonably consistently in the following way: call If only one call to that function is made, then this error will not appear at all. On the other hand, if the calls to Beside the function above, this bug may also be reproduced by calling other functions in quick succession, though I've not tested them. Until this bug is resolved, this library is regrettably unusable. |
This is far from idea but it's a temporary solution we're using. We're using ReactiveX/rxjs to handle all our I/O including CBL. We've created a standard function to replace export const putDoc = (db: string, docId: string, doc: object): Observable<object> => managerReady$
.flatMap(dbManager => dbManager.document.put({db, doc: docId, body: doc}))
.retryWhen(attempts$ => attempts$
.scan((errorCount, err) => {
if (errorCount >= 3) {
throw err;
}
return errorCount + 1;
}, 0)
.delayWhen(i => Observable.timer(i * 50))
)
.map((result: CouchbaseWriteResult) => {
if (result.status >= 300 || result.status < 200) {
throw result;
}
return doc;
}); When the write attempt fails it will retry 3 times with a slight exponential backoff before bubbling the error up. Hope that can help someone who's stuck like we have been. |
I've been seeing this too. Thanks for the advice everyone |
Quite often things work but every so often the HTTP request to CBL either sort of or fully fails with:
Doing the exact same test-case every time sometimes the document will save, sometimes not. And sometimes the document will be saved but this error still happens.
What can I do to fix this or what additional info can I provide to further troubleshoot this. I'm also attaching the screenshot of the console.error:
The text was updated successfully, but these errors were encountered: