orgnote icon indicating copy to clipboard operation
orgnote copied to clipboard

[Bug] sync is not working anymore

Open SemyonSinchenko opened this issue 1 year ago • 10 comments

Thank you for the bug report

  • [X] I am using the latest version of the OrgNote app.
  • [X] I already checked other related issues
  • [X] I have read the WIKI

Bug description and steps to reproduce

I have local notes and regularly do orgnote-cli sync but after I run foce-sync in the web app / android all my notes diapered. At the same time, orgnote-cli sync is successful locally.

⬢[sem@toolbox ~]$ orgnote-cli sync --debug
2024-10-09T11:36:30.435Z-info: info.message
info: Current configuration: {
  remoteAddress: 'https://org-note.com/api/v1',
  token: 'xxx',
  rootFolder: '/var/home/sem/Nextcloud/ORG/orgnote',
  version: 'v1',
  logPath: '~/var/logs/orgnote.log',
  backupCount: 2,
  name: 'Main',
  backupDir: '/var/home/sem/Nextcloud/Backup/Orgnote',
  encrypt: 'gpgPassword',
  gpgPassword: 'xxx',
  _: [ 'sync', [length]: 1 ],
  debug: true,
  '$0': '/usr/local/bin/orgnote-cli'
}
[line 64]: LOG FILE ALREADY EXISTS ~/var/logs/orgnote.log
2024-10-09T11:36:30.438Z-info: info.message
info: ✎: [backup.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] old backups will be deleted [ '2024-10-09T11:16:29.914Z.zip', [length]: 1 ]
2024-10-09T11:36:30.438Z-info: info.message
info: ✎: [backup.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] backups stored into '/var/home/sem/Nextcloud/Backup/Orgnote/2024-10-09T11:36:30.438Z.zip'
2024-10-09T11:36:30.511Z-info: info.message
info: ✎: [sync-notes.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] last sync from 2024-10-09T11:33:56.998Z
2024-10-09T11:36:30.512Z-info: info.message
info: ✎: [sync-notes.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] encryption changed from the last sync false
2024-10-09T11:36:30.514Z-info: info.message
info: ✎: [sync-notes.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] files found to sync 0
2024-10-09T11:36:30.515Z-info: info.message
info: ✎: [sync-notes.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] notes from last sync:
 [ [length]: 0 ]
2024-10-09T11:36:30.517Z-info: info.message
info: Files to sync: 
2024-10-09T11:36:30.518Z-info: info.message
info: Files length to send: 0
2024-10-09T11:36:30.771Z-info: info.message
info: ✎: [sync-notes.ts][Wed Oct 09 2024 13:36:30 GMT+0200 (Central European Summer Time)] 
  notes updated from remote:
	[ [length]: 0 ]
  notes ids to delete:
	[ [length]: 0 ]

I'm 100% using the right token and URL, I checked it multiple times before posting an issue.

I have also some problems with orgnote-cli:

⬢[sem@toolbox ~]$ orgnote-cli --version
unknown
⬢[sem@toolbox ~]$ orgnote-cli publish-all --debug
2024-10-09T11:39:02.523Z-info: info.message
info: Current configuration: {
  remoteAddress: 'https://org-note.com/api/v1',
  token: 'xxx',
  rootFolder: '/var/home/sem/Nextcloud/ORG/orgnote',
  version: 'v1',
  logPath: '~/var/logs/orgnote.log',
  backupCount: 2,
  name: 'Main',
  backupDir: '/var/home/sem/Nextcloud/Backup/Orgnote',
  encrypt: 'gpgPassword',
  gpgPassword: 'xxx',
  _: [ 'publish-all', [length]: 1 ],
  debug: true,
  '$0': '/usr/local/bin/orgnote-cli'
}
[line 64]: LOG FILE ALREADY EXISTS ~/var/logs/orgnote.log
2024-10-09T11:39:02.526Z-info: info.message
info: ✎: [backup.ts][Wed Oct 09 2024 13:39:02 GMT+0200 (Central European Summer Time)] old backups will be deleted [ '2024-10-09T11:16:52.202Z.zip', [length]: 1 ]
2024-10-09T11:39:02.526Z-info: info.message
info: ✎: [backup.ts][Wed Oct 09 2024 13:39:02 GMT+0200 (Central European Summer Time)] backups stored into '/var/home/sem/Nextcloud/Backup/Orgnote/2024-10-09T11:39:02.526Z.zip'
2024-10-09T11:39:02.605Z-error: info.message
error: Unexpected error: Error: ENOENT: no such file or directory, stat 'publish-all'
    at statSync (node:fs:1665:25)
    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72374:54
    at step (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72268:23)
    at Object.next (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72249:53)
    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72243:71
    at new Promise (<anonymous>)
    at prepare_note_awaiter (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72239:12)
    at prepareNotes (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72369:12)
    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72703:32
    at step (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72655:23) {
  [stack]: "Error: ENOENT: no such file or directory, stat 'publish-all'\n" +
    '    at statSync (node:fs:1665:25)\n' +
    '    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72374:54\n' +
    '    at step (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72268:23)\n' +
    '    at Object.next (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72249:53)\n' +
    '    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72243:71\n' +
    '    at new Promise (<anonymous>)\n' +
    '    at prepare_note_awaiter (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72239:12)\n' +
    '    at prepareNotes (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72369:12)\n' +
    '    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72703:32\n' +
    '    at step (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:72655:23)',
  [message]: "ENOENT: no such file or directory, stat 'publish-all'",
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'publish-all'
}
node:fs:2376
    validateStringAfterArrayBufferView(data, 'data');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Error
    at writeFileSync (node:fs:2376:5)
    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:73708:51
    at step (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:73649:23)
    at Object.throw (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:73630:53)
    at rejected (file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:73622:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.17.0

May it it be anyhow related to my problem with missing notes in web/android?

Debug info

OrgNote: 0.21.8 Language: en-US

Screen: Screen resolution: 1920x1200 Screen color depth: 24 Device pixel ratio: 1.25

Encryption: Type: gpgPassword Password provided: true

Env: API URL: https://org-note.com/api/v1/ AUTH URL: MODE: production

Quasar info: chrome: true version: 129.0.0.0 versionNumber: 129 linux: true desktop: true webkit: true name: chrome platform: linux standalone: false

Additional context

No response

SemyonSinchenko avatar Oct 09 '24 11:10 SemyonSinchenko

Can you try press force sync again? (androi/web version)

One of the upcoming migrations was incompatible with the old code.

Still investigating a local bug related to orgnote-cli

Artawower avatar Oct 09 '24 23:10 Artawower

Thanks, force sync works fine now!

SemyonSinchenko avatar Oct 10 '24 08:10 SemyonSinchenko

@Artawower For some unknown reason sync is not working again. May it be because of a new release? I tried to find a root and saw this in logs:

[error] ["QPage needs to be child of QPageContainer"] 
[error] ["Hydration completed but contains mismatches."] 
[log] ["Service worker has been registered."] 
[log] ["New content is downloading."] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[error] ["QPage needs to be child of QPageContainer"] 
[error] ["Hydration completed but contains mismatches."] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[log] ["Service worker is active."] 
[log] ["Service worker has been registered."] 
[error] ["QPage needs to be child of QPageContainer"] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[error] ["QPage needs to be child of QPageContainer"] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[error] ["QPage needs to be child of QPageContainer"] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[error] ["QPage needs to be child of QPageContainer"] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[error] ["QPage needs to be child of QPageContainer"] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 
[error] ["QPage needs to be child of QPageContainer"] 
[log] ["✎: [line 39][file-manager.ts] files: ",[]] 

There is a debug info:

OrgNote: 0.22.0
Language: en-US

Screen:
  Screen resolution: 1920x1200
  Screen color depth: 24
  Device pixel ratio: 1.25

Encryption:
  Type: disabled

Env:
  API URL: https://org-note.com/api/v1/
  AUTH URL: 
  MODE: production

Quasar info:
  chrome: true
  version: 130.0.0.0
  versionNumber: 130
  linux: true
  desktop: true
  webkit: true
  name: chrome
  platform: linux
 standalone: false

SemyonSinchenko avatar Oct 25 '24 15:10 SemyonSinchenko

Yes it's related to the recent migration. The files on the remote machine were purged due to a change in storage mechanism. Synchronization with the server is currently unstable

I am already in the process of resolving the issues

Artawower avatar Oct 26 '24 20:10 Artawower

@Artawower Is it possible maybe to delete all the remote notes and re-sync everything from the backup? Can it help to resolve the sync problem?

SemyonSinchenko avatar Nov 02 '24 17:11 SemyonSinchenko

Yes, that should help. But unfortunately there is 1 unfixable bug in the current file system, and it won't be fixed. Unfortunately, even after synchronizing your notes, you probably won't be able to open them if the number of files is large.

This threw me off a bit, I tried 5 different filesystems running in browsers and each one had either very critical bugs or lacked basic features (like directory renaming and utime, atime storage).

So for the last week I've been writing my own filesystem on top of dexie. I will try to finish it this weekend.

Artawower avatar Nov 02 '24 19:11 Artawower

Try re-synchronizing your notes with the --force flag. After logging in, the notes should resynchronize.

Don't forget to update orgnote-cli to 0.12.2.

Also, important clarification, with the latest release I have dropped the manual encryption of notes, leaving this functionality for .org.gpg files (support for them will be available soon).

Artawower avatar Nov 03 '24 20:11 Artawower

@Artawower Unfortunately I'm still getting the error locally:

[sem@toolbox ORG]$ orgnote-cli --debug --sync --force
2024-11-04T09:46:23.718Z-warn: info.message
warn: Force sync enabled. All cache will be cleared.
2024-11-04T09:46:23.721Z-info: info.message
info: Current configuration: {
  remoteAddress: 'https://org-note.com/api/v1',
  token: '***',
  rootFolder: '/var/home/sem/Nextcloud/ORG/orgnote',
  version: 'v1',
  logPath: '~/var/logs/orgnote.log',
  backupCount: 2,
  name: 'Main',
  backupDir: '/var/home/sem/Nextcloud/Backup/Orgnote',
  encrypt: 'gpgPassword',
  gpgPassword: '***',
  _: [ [length]: 0 ],
  debug: true,
  sync: true,
  force: true,
  '$0': '/usr/local/bin/orgnote-cli'
}
[line 64]: LOG FILE ALREADY EXISTS ~/var/logs/orgnote.log
2024-11-04T09:46:23.722Z-error: info.message
error: Unexpected error: 'Command undefined is not supported'
node:fs:2368
    return binding.writeFileUtf8(
                   ^
                                                                                                                                                                           
Error: ENOENT: no such file or directory, open '~/var/logs/orgnote.log'
    at writeFileSync (node:fs:2368:20)
    at file:///usr/local/lib/node_modules/orgnote-cli/dist/index.js:115646:43 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '~/var/logs/orgnote.log'
}

What can I try? Should I maybe delete and re-install the cli, or what? I'm not very familiar with npm system tbh. I'm getting the error after running sudo npm update -g and it looks like I'm on the latest version:

[sem@toolbox ORG]$ npm list -g | rg orgnote
├── [email protected]

NPM version: 10.9.0 NodeJS version: 20.17.0

SemyonSinchenko avatar Nov 04 '24 09:11 SemyonSinchenko

It appears that the command is incorrect a bit, the correct command is orgnote-cli sync --debug --force

Artawower avatar Nov 04 '24 11:11 Artawower

@Artawower Thanks a lot! It finally works!!!

SemyonSinchenko avatar Nov 04 '24 11:11 SemyonSinchenko