Error during PouchDB to CouchDB replication - "Only DELETE,GET,HEAD,POST allowed"

StackOverflow https://stackoverflow.com/questions/16856181

  •  30-05-2022
  •  | 
  •  

سؤال

I'm getting an error when trying to replicate from PouchDB (using http://www.pouchvision.com/) to CouchDB (using a local installation).

Investigating the error with Fiddler, it seems that during a replication PouchDB is calling

http://127.0.0.1:5984/targetdb/

using the "OPTIONS" method and that CouchDB returns:

{
  "error": "method_not_allowed",
  "reason":"Only DELETE,GET,HEAD,POST allowed"
}

I've also used Fiddler to inspect CouchDB to CouchDB replication and in this case the replication makes 2 calls to the same url using the "HEAD" and "GET" methods and all works fine.

Questions: Has anybody else had the same problem? Am I doing something wrong? Or is this a bug in PouchDB (or in www.pouchvision.com)?

هل كانت مفيدة؟

المحلول

The OPTIONS request is coming from your browser, not PouchDB. From WikiPedia:

the specification mandates that browsers “preflight” the request, soliciting supported methods from the server with an HTTP OPTIONS request header

The error you're seeing isn't fatal, usually. Check your local database to see if replication actually failed. If you are only seeing the error from the OPTIONS request, then it's possible replication went without a problem.

Also make sure you are using the latest CouchDB (1.3.x I beleive) as it has built-in CORS support.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top