-
-
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
rxdb addCollections err TypeError: Cannot read properties of null (reading 'hasOwnProperty') #4055
Comments
Your schema looks ok, this should work. |
You should start with a unit test that reproduces the problem |
You need at least node 18. https://rxdb.info/releases/13.0.0.html |
Thanks for the help, progress made, stuck with this error The port 5000 is being used by control center, which is a Mac OS system app, I tried killing it, but not work, it always restarts itself right after killing. I hard-coded the server-couchbase.ts to serve at another port, but having this same problem on another port 🤣 What am I missing here? thanks :) |
I fixed it to no longer use hard coded port numbers. |
how to run only a single test file please? |
I removed all the other tests and added this one, now it can be reproduced 😀 /**
* this is a template for a test.
* If you found a bug, edit this test to reproduce it
* and than make a pull-request with that failing test.
* The maintainer will later move your test to the correct possition in the test-suite.
*
* To run this test do:
* - 'npm run test:node' so it runs in nodejs
* - 'npm run test:browser' so it runs in the browser
*/
import { createRxDatabase, addRxPlugin } from '../../';
import { RxDBDevModePlugin } from '../../plugins/dev-mode';
import config from './config';
describe('TypeError: Cannot read properties of null (reading hasOwnProperty)', () => {
it('should fail because it reproduces the bug', async () => {
// create a schema
const userSchema = {
title: 'user schema',
description: 'describes a user',
type: 'object',
version: 0,
// re-enable once not use dexie.js engine for the web since it does not support it
keyCompression: false,
primaryKey: 'id',
properties: {
id: {
type: 'string',
maxLength: 100,
},
birthday: {
type: ['string', 'null'],
default: null,
},
createTime: {
type: 'string',
},
},
required: ['id', 'createTime', 'updateTime'],
};
// generate a random database-name
const name = 'test-app';
addRxPlugin(RxDBDevModePlugin);
// create a database
const db = await createRxDatabase({
name,
/**
* By calling config.storage.getStorage(),
* we can ensure that all variations of RxStorage are tested in the CI.
*/
storage: config.storage.getStorage(),
});
// create a collection
await db.addCollections({
users: {
schema: userSchema,
},
});
});
}); |
for the following schema:
I get an error when creating the database, remove the usage of devplugin "solves" it...
wonder if I am missing something or a bug.
a reproducible repo here:
https://github.com/Albert-Gao/my-rxdb-app
Digging
With some debug, I found the issue here in this function,
You can see the runtime value for
schemaObj
is"string"
which is not an object, thus causes the problem, do not know the cause though.The text was updated successfully, but these errors were encountered: