-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
BUG leveldown module at adapter option throw error. 'leveldb' string solve it #2251
Comments
It works in this test. |
I'm sorry, i dont give you enough explanation. if you use leveldb adaptar it give you the error explained above import { createRxDatabase, addRxPlugin } from 'rxdb';
// add the server-plugin
import { RxDBServerPlugin } from 'rxdb/plugins/server';
addRxPlugin( RxDBServerPlugin );
addRxPlugin( require( 'pouchdb-adapter-node-websql' ) );
async function run() {
// create database
const db = await createRxDatabase( {
name: 'database/mydb',
adapter: 'websql',
} );
// create collection
const mySchema = {
version: 0,
type: 'object',
properties: {
key: {
type: 'string',
primary: true,
},
value: {
type: 'string',
},
},
};
await db.collection( {
name: 'items',
schema: mySchema,
} );
// insert one document
await db.items.insert( {
key: `${Date.now()}`,
value: 'bar',
} );
const { app, server } = db.server( {
path: '/db', // (optional)
port: 3000, // (optional)
cors: true, // (optional), enable CORS-headers
startServer: true, // (optional), start express server
// options of the pouchdb express server
pouchdbExpressOptions: {
inMemoryConfig: true, // do not write a config.json
logPath: '/tmp/rxdb-server-log.txt', // save logs in tmp folder
},
} );
console.log( 'ready' );
}
run(); |
after a days i noticed that the problem only occurs when you set a name with a custom path like 'database/mydb' but if i set 'mydb' it will work. With custom path name the url /mydb-rxdb-0-items is not being created and the function pseudo.allDbs() inside server.js plugin return a database with name database/mydb-rxdb-0-items i think pouchdb server module is creating the route with other name due the characters / are not allowed (url encoding: database%2Fmydb-rxdb-0-items no works) OR the route is not being create at all |
Can you make a PR with a failing test? I can then start fixing this. |
I tried in a project and found the same problem. |
Ok so the problem occurs when you have an ending slash in the database name. When you have a path like Please check if this helps and tell me if you still have an error. |
I get an error after creating the server
|
@KVAnton-WEB please make a PR with a failing test. |
BUG
RxDBServerPlugin no work correctly if you use the leveldown adapter for nodejs enviroment:
this throw error :
if i pass the string 'leveldb' to adapter it init correctly, but when i try to get a collection for example db/users it throw {"error":"not_found","reason":"no_db_file"}. the rxdb.users works correctly
with node websql adapter happenes the same, rxdb works correctly but server throw {"error":"not_found","reason":"no_db_file"}
The text was updated successfully, but these errors were encountered: