According to information provided in the official documentation:
Error 500 - Internal Server Error
The request was deemed invalid due to either malformed JSON data or incorrect information included within the request.
In order to effectively troubleshoot and replicate your issue, more detailed information is required.
I experimented with utilizing the createIndex
API on NodeJS to identify any potential challenges. Below is the code snippet I used in a file labeled server.js
:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; // Bypass rejection as the SSL certificate of CouchDB is self-signed
//import PouchDB from 'pouchdb'
const PouchDB = require('pouchdb')
PouchDB.plugin(require('pouchdb-find'))
const db = new PouchDB('https://admin:****@192.168.1.106:6984/reproduce')
db.createIndex({
index: {
fields: ['title']
}
}).then((result) => {
console.log(result)
}).catch((error) => {
console.log(error)
})
Upon executing the code, everything ran smoothly:
$ node server.js
{ result: 'created',
id: '_design/94407075806d27d94ac764d9aa138a43c015dc1f',
name: '94407075806d27d94ac764d9aa138a43c015dc1f' }
Hence, it seems that there shouldn't be any issues with using createIndex
on NodeJS. Here are the versions of my PouchDB:
{
"name": "reproduce-pouchdb-tls",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"pouchdb": "^6.4.3",
"pouchdb-find": "^6.4.3"
}
}