-
-
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
Getting 'Unexpected end of JSON input' exception in encryption.js #917
Comments
Hi @rmisio thanks for reporting. |
Ok, here's basically what I'm doing... I tweaked the code a little to simplify it:
It looks like the sync part (the last code block) is what's causing the issue because if I remove that part, I don't get the error. |
I don't see anything of note in the sync db server logs. And, the issue happens whether the sync server is running or not.
|
It look like you replicate unencrypted data into the rxdb collection |
I'm not sure what you mean? Actually in it's simplest form I could replicate this without any data. I just follow the code that I posted and prior to adding in any data to the db, the error happens. Where are you seeing that I am "replicate unencrypted data into the rxdb collection"? |
I think you sync with a couchdb-instance that has stored the fields without encryption. Then you have non-encrypted data locally and rxdb tries to decrypt it, which is not possible and causes the crash |
hmm... I'm not sure how I did that. I've used rxdb before and set-up encrypted data which I've synced remotely. I've used the same set-up I'm using now, outside of perhaps now using newer versions of rxdb and pouchdb-server. So, what exactly do I need to do to be able to sync this encrypted data? This is the db server I'm using: |
Can you query the documents directly from the colelctions pouchdb |
@pubkey Sorry for the delayed response. i got side-tracked onto another project. Anyhow, here's the sole document in the collection (this is via the Fauxton UI):
|
Not sure if this is relevant, but I'm also getting this in the console:
|
Also that same exception in |
How was the initial document created? The base64-string are not encrypted json from rxdb or? |
I pull the
and then I pass them here:
There's no encryption happening on my end. I think it's happening in RxDB or one of it's dependencies. |
@pubkey Any update on this? |
@pubkey Here's a test that reproduces this one. https://github.com/rmisio/rxdb/blob/master/test/unit/encrypt-bug-917.test.js I've found the issue is that it throws this exception on the read of an encrypted field of type So, it does let you save without issue, just chokes on a subsequent read. |
@rmisio thanks for the test. |
Case
bug
Issue
Getting the following exception:
Not exactly sure which part of my code triggers it, since the stack trace references none of my files.
Info
Code
Here's my schema:
Here's a dump of my db:
The text was updated successfully, but these errors were encountered: