jckleiner / notion-backup

Automatic Notion workspace backup to Google Drive, Dropbox, pCloud, Nextcloud or to your local machine.
90 stars 36 forks source link

Could not export notion file #1

Closed damienreyre closed 2 years ago

damienreyre commented 2 years ago

Hello,

OS : Debian 11

I'm very interested in your notion backup. I tried local backup and nextcloud backup. I already configured my .env for different variables. But I have the same error :

Exception in thread "main" java.lang.IllegalStateException: Could not export notion file at com.greydev.notionbackup.NotionBackup.lambda$main$0(NotionBackup.java:47) at java.base/java.util.Optional.orElseThrow(Optional.java:408) at com.greydev.notionbackup.NotionBackup.main(NotionBackup.java:47)

Do you any ideas ?

Damien

jckleiner commented 2 years ago

Hello Damien, This could have many different reasons. Could you start another export and copy-paste all the log messages you get once the program starts? Maybe then I could help you.

damienreyre commented 2 years ago

Hello jckleiner,

docker version Client: Docker Engine - Community Version: 20.10.14 API version: 1.41 Go version: go1.16.15 Git commit: a224086 Built: Thu Mar 24 01:48:21 2022 OS/Arch: linux/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.10 API version: 1.41 (minimum version 1.12) Go version: go1.16.9 Git commit: e2f740d Built: Mon Oct 25 07:41:30 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.5.11 GitCommit: 3df54a852345ae127d1fa3092b95168e4a88e2f8 runc: Version: 1.0.3 GitCommit: v1.0.3-0-gf46b6ba docker-init: Version: 0.19.0 GitCommit: de40ad0

I double-checked my ".env". There are no quotes. I double-checked my rights for the "env" file and the backup folder.

For Cloud: sudo docker run \ --rm=true \ --env-file=.env \ jckleiner/notion-backup

05:28:19.175 [main] INFO com.greydev.notionbackup.NotionClient - Using export type: markdown 05:28:20.297 [main] INFO com.greydev.notionbackup.NotionClient - tokenV2 extracted 05:28:20.559 [main] INFO com.greydev.notionbackup.NotionClient - taskId extracted 05:28:20.862 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 3 05:28:25.077 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 72 05:28:29.281 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 153 05:28:33.523 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 213 05:28:37.714 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 243 05:28:41.912 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 356 05:28:46.111 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 435 05:28:50.293 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 490 05:28:54.474 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 578 05:28:58.667 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 663 05:29:02.847 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:07.028 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:11.230 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:15.437 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:19.622 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:23.820 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:28.030 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:32.227 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:36.407 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:40.592 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:29:44.593 [main] INFO com.greydev.notionbackup.NotionClient - downloadLink could not be extracted Exception in thread "main" java.lang.IllegalStateException: Could not export notion file at com.greydev.notionbackup.NotionBackup.lambda$main$0(NotionBackup.java:47) at java.base/java.util.Optional.orElseThrow(Optional.java:408) at com.greydev.notionbackup.NotionBackup.main(NotionBackup.java:47)

For local: sudo docker run \ --rm=true \ --env-file=/opt/.env \ -v /backup/notion:/downloads \ jckleiner/notion-backup

05:33:24.224 [main] INFO com.greydev.notionbackup.NotionClient - Using export type: markdown 05:33:25.517 [main] INFO com.greydev.notionbackup.NotionClient - tokenV2 extracted 05:33:26.239 [main] INFO com.greydev.notionbackup.NotionClient - taskId extracted 05:33:26.575 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 3 05:33:30.768 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 65 05:33:34.973 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 161 05:33:39.194 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 216 05:33:43.391 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 299 05:33:47.596 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 383 05:33:51.783 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 464 05:33:55.990 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 552 05:34:00.198 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 601 05:34:04.392 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:09.046 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:13.236 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:17.465 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:21.656 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:25.844 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:30.061 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:34.256 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:38.450 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:43.096 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:47.288 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 05:34:51.288 [main] INFO com.greydev.notionbackup.NotionClient - downloadLink could not be extracted Exception in thread "main" java.lang.IllegalStateException: Could not export notion file at com.greydev.notionbackup.NotionBackup.lambda$main$0(NotionBackup.java:47) at java.base/java.util.Optional.orElseThrow(Optional.java:408) at com.greydev.notionbackup.NotionBackup.main(NotionBackup.java:47)

I can see few errors in my syslog : Apr 16 07:38:03 nextcloud systemd[1]: var-lib-docker-overlay2-d653716c209b8fccd12fd470e501c281a4e0ad0645c65129f9db8741e250dad6\x2dinit-merged.mount: Succeeded. Apr 16 07:38:03 nextcloud systemd[114267]: var-lib-docker-overlay2-d653716c209b8fccd12fd470e501c281a4e0ad0645c65129f9db8741e250dad6\x2dinit-merged.mount: Succeeded. Apr 16 07:38:03 nextcloud systemd[1]: var-lib-docker-overlay2-d653716c209b8fccd12fd470e501c281a4e0ad0645c65129f9db8741e250dad6-merged.mount: Succeeded. Apr 16 07:38:03 nextcloud kernel: [306313.616155] docker0: port 1(veth4e05493) entered blocking state Apr 16 07:38:03 nextcloud kernel: [306313.624721] docker0: port 1(veth4e05493) entered disabled state Apr 16 07:38:03 nextcloud kernel: [306313.625943] device veth4e05493 entered promiscuous mode Apr 16 07:38:03 nextcloud systemd-udevd[123953]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable. Apr 16 07:38:03 nextcloud systemd-udevd[123953]: Using default interface naming scheme 'v247'. Apr 16 07:38:03 nextcloud systemd-udevd[123954]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable. Apr 16 07:38:03 nextcloud systemd-udevd[123954]: Using default interface naming scheme 'v247'. Apr 16 07:38:03 nextcloud containerd[97506]: time="2022-04-16T07:38:03.718036231+02:00" level=info msg="starting signal loop" namespace=moby path=/run/containerd/io.containerd.runtime.v2.task/moby/29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec pid=123972 Apr 16 07:38:03 nextcloud systemd[114267]: run-docker-runtime\x2drunc-moby-29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec-runc.73okRz.mount: Succeeded. Apr 16 07:38:03 nextcloud systemd[1]: Started libcontainer container 29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec. Apr 16 07:38:03 nextcloud kernel: [306314.000897] eth0: renamed from veth10b1e13 Apr 16 07:38:04 nextcloud kernel: [306314.031014] IPv6: ADDRCONF(NETDEV_CHANGE): veth4e05493: link becomes ready Apr 16 07:38:04 nextcloud kernel: [306314.032575] docker0: port 1(veth4e05493) entered blocking state Apr 16 07:38:04 nextcloud kernel: [306314.033887] docker0: port 1(veth4e05493) entered forwarding state Apr 16 07:39:32 nextcloud systemd[1]: docker-29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec.scope: Succeeded. Apr 16 07:39:32 nextcloud systemd[1]: docker-29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec.scope: Consumed 3.758s CPU time. Apr 16 07:39:32 nextcloud dockerd[98953]: time="2022-04-16T07:39:32.544069053+02:00" level=info msg="ignoring event" container=29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete" Apr 16 07:39:32 nextcloud containerd[97506]: time="2022-04-16T07:39:32.545192488+02:00" level=info msg="shim disconnected" id=29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec Apr 16 07:39:32 nextcloud containerd[97506]: time="2022-04-16T07:39:32.545285519+02:00" level=warning msg="cleaning up after shim disconnected" id=29fe76efeb6b0b32df43d1c0b8b54bb12be2fc69622517dcc435cc24542bfbec namespace=moby Apr 16 07:39:32 nextcloud containerd[97506]: time="2022-04-16T07:39:32.545312732+02:00" level=info msg="cleaning up dead shim" Apr 16 07:39:32 nextcloud containerd[97506]: time="2022-04-16T07:39:32.561868333+02:00" level=warning msg="cleanup warnings time=\"2022-04-16T07:39:32+02:00\" level=info msg=\"starting signal loop\" namespace=moby pid=124644\n" Apr 16 07:39:32 nextcloud kernel: [306402.600773] docker0: port 1(veth4e05493) entered disabled state Apr 16 07:39:32 nextcloud kernel: [306402.601996] veth10b1e13: renamed from eth0 Apr 16 07:39:32 nextcloud systemd-udevd[124657]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable. Apr 16 07:39:32 nextcloud systemd-udevd[124657]: Using default interface naming scheme 'v247'. Apr 16 07:39:32 nextcloud kernel: [306402.639722] docker0: port 1(veth4e05493) entered disabled state Apr 16 07:39:32 nextcloud kernel: [306402.641689] device veth4e05493 left promiscuous mode Apr 16 07:39:32 nextcloud kernel: [306402.642649] docker0: port 1(veth4e05493) entered disabled state Apr 16 07:39:32 nextcloud systemd-udevd[124657]: **veth10b1e13: Failed to query device driver: No such device** Apr 16 07:39:32 nextcloud systemd-udevd[124657]: **veth10b1e13: Failed to get link config: No such device** Apr 16 07:39:32 nextcloud systemd[114267]: run-docker-netns-ccd1d47b17fd.mount: Succeeded. Apr 16 07:39:32 nextcloud systemd[1]: run-docker-netns-ccd1d47b17fd.mount: Succeeded. Apr 16 07:39:32 nextcloud systemd[114267]: var-lib-docker-overlay2-d653716c209b8fccd12fd470e501c281a4e0ad0645c65129f9db8741e250dad6-merged.mount: Succeeded. Apr 16 07:39:32 nextcloud systemd[1]: var-lib-docker-overlay2-d653716c209b8fccd12fd470e501c281a4e0ad0645c65129f9db8741e250dad6-merged.mount: Succeeded.

Damien

damienreyre commented 2 years ago

For the logs, two lines can be interesting are : Apr 16 07:39:32 nextcloud systemd-udevd[124657]: veth10b1e13: Failed to query device driver: No such device Apr 16 07:39:32 nextcloud systemd-udevd[124657]: veth10b1e13: Failed to get link config: No such device

damienreyre commented 2 years ago

For information, I tried on Github. I have the same error.

Set up job `

1s Current runner version: '2.289.2' Operating System Virtual Environment Virtual Environment Provisioner GITHUB_TOKEN Permissions Secret source: Actions Prepare workflow directory Prepare all required actions Getting action download info Download action repository 'kohlerdominik/docker-run-action@v1' (SHA:c4203dd46fec7fe450a55fbf7b789489d207fd42)`

`Run kohlerdominik/docker-run-action@v1

These instructions are passed to the container: ----- START OF FILE ----- echo "hello world" uname -a ----- END OF FILE ----- /usr/bin/docker run --env=NOTION_SPACE_ID= --env=NOTION_EMAIL= --env=NOTION_PASSWORD= --env=GOOGLE_DRIVE_ROOT_FOLDER_ID= --env=GOOGLE_DRIVE_SERVICE_ACCOUNT= --env=GOOGLE_DRIVE_SERVICE_ACCOUNT_SECRET_JSON= --env=GOOGLE_DRIVE_SERVICE_ACCOUNT_SECRET_FILE_PATH= --env=DROPBOX_ACCESS_TOKEN= --env=NEXTCLOUD_EMAIL= --env=NEXTCLOUD_PASSWORD= --env=NEXTCLOUD_WEBDAV_URL= --volume=/home/runner/work/_temp/a95f2c73-4af9-441b-bc30-a75cbd1994cb.sh:/tmp/a95f2c73-4af9-441b-bc30-a75cbd1994cb.sh jckleiner/notion-backup sh -e /tmp/a95f2c73-4af9-441b-bc30-a75cbd1994cb.sh Unable to find image 'jckleiner/notion-backup:latest' locally latest: Pulling from jckleiner/notion-backup 0e29546d541c: Pulling fs layer 9b829c73b52b: Pulling fs layer cb5b7ae36172: Pulling fs layer 6494e4811622: Pulling fs layer 668f6fcc5fa5: Pulling fs layer dc120c3e0290: Pulling fs layer 8f7c0eebb7b1: Pulling fs layer 136eb9fb4adc: Pulling fs layer feaa70d122e2: Pulling fs layer f0dd4306cd9d: Pulling fs layer 6494e4811622: Waiting 668f6fcc5fa5: Waiting dc120c3e0290: Waiting 8f7c0eebb7b1: Waiting 136eb9fb4adc: Waiting feaa70d122e2: Waiting f0dd4306cd9d: Waiting 9b829c73b52b: Verifying Checksum 9b829c73b52b: Download complete cb5b7ae36172: Verifying Checksum cb5b7ae36172: Download complete 668f6fcc5fa5: Verifying Checksum 668f6fcc5fa5: Download complete 0e29546d541c: Verifying Checksum 0e29546d541c: Download complete dc120c3e0290: Verifying Checksum dc120c3e0290: Download complete 6494e4811622: Verifying Checksum 6494e4811622: Download complete 136eb9fb4adc: Verifying Checksum 136eb9fb4adc: Download complete feaa70d122e2: Verifying Checksum feaa70d122e2: Download complete f0dd4306cd9d: Verifying Checksum f0dd4306cd9d: Download complete 8f7c0eebb7b1: Verifying Checksum 8f7c0eebb7b1: Download complete 0e29546d541c: Pull complete 9b829c73b52b: Pull complete cb5b7ae36172: Pull complete 6494e4811622: Pull complete 668f6fcc5fa5: Pull complete dc120c3e0290: Pull complete 8f7c0eebb7b1: Pull complete 136eb9fb4adc: Pull complete feaa70d122e2: Pull complete f0dd4306cd9d: Pull complete Digest: sha256:b5753a9b764a644c35f8808f511ed722cfd2f87fc1af0b417bba7118b5429b4b Status: Downloaded newer image for jckleiner/notion-backup:latest 06:11:15.096 [main] INFO com.greydev.notionbackup.NotionClient - Using export type: markdown 06:11:15.894 [main] INFO com.greydev.notionbackup.NotionClient - tokenV2 extracted 06:11:16.266 [main] INFO com.greydev.notionbackup.NotionClient - taskId extracted 06:11:16.465 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 2 06:11:20.588 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 58 06:11:24.915 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 128 06:11:29.041 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 198 06:11:33.160 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 232 06:11:37.293 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 307 06:11:41.429 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 396 06:11:45.556 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 468 06:11:49.672 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 487 06:11:53.798 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 545 06:11:57.933 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 606 06:12:02.047 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 662 06:12:06.175 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:10.553 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:14.949 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:19.069 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:23.447 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:27.579 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:31.964 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:36.081 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 06:12:40.082 [main] INFO com.greydev.notionbackup.NotionClient - downloadLink could not be extracted Exception in thread "main" java.lang.IllegalStateException: Could not export notion file at com.greydev.notionbackup.NotionBackup.lambda$main$0(NotionBackup.java:47) at java.base/java.util.Optional.orElseThrow(Optional.java:408) at com.greydev.notionbackup.NotionBackup.main(NotionBackup.java:47) Error: The process '/usr/bin/docker' failed with exit code 1`

jckleiner commented 2 years ago

Your workspace export from Notion starts without an issue, seen in the logs tokenV2 extracted, taskId extracted, State: 'in_progress', Pages exported: 670 and the program waits untill this state (which is contained in the Notion API response) is success and only then the Notion response will contain a download-URL and the export file can be downloaded.

I assume the problem is that your export is taking longer than expected and before Notion has finished preparing your export, the program quits. In the current implementation the program waits around 2 minutes and if the state is still not success it fails. If you get an email from notion telling that your export is ready, then this is the problem, notion takes longer than the notion-export app waits.

I've increased this 'timeout' to 10 minutes. So now the program will continuously ask for the state, for 10 minutes. I've also added some more log messages. Can you try to do another export? Hopefully this should be enough to fix your problem.

If you get another error, you could again paste the logs, starting from the line com.greydev.notionbackup.NotionClient - Using export type: markdown and I'll try to take another look.

And keep in mind that Notion has a limit on how many export requests you can send. If you send too many during a short time frame, Notion might reject your request and you will see an error like this: Too many requests were sent. Notion is returning a 429 status code (Too many requests).. If that's the case, you need to wait before you can send another request, not sure how long exactly but I guess half a day or so. After that you will be allowed to send export requests again.

damienreyre commented 2 years ago

Thanks for your answer.

Interesting that you said about the limit of Notion. Where can I see this error? Too many requests were sent. Notion is returning a 429 status code (Too many requests).. Directly in my console?

Unfortunately, I tried again two times (local and cloud). I get the same error : 08:25:34.269 [main] INFO com.greydev.notionbackup.NotionClient - Using export type: markdown 08:25:35.366 [main] INFO com.greydev.notionbackup.NotionClient - tokenV2 extracted 08:25:35.690 [main] INFO com.greydev.notionbackup.NotionClient - taskId extracted 08:25:38.094 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 26 08:25:42.288 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 112 08:25:46.504 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 143 08:25:50.696 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 205 08:25:54.890 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 232 08:25:59.095 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 337 08:26:03.289 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 421 08:26:07.501 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 473 08:26:11.701 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 556 08:26:15.884 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 635 08:26:20.072 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:24.267 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:28.447 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:32.640 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:36.831 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:41.034 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:45.217 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:49.413 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:53.602 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:26:57.783 [main] INFO com.greydev.notionbackup.NotionClient - State: 'in_progress', Pages exported: 670 08:27:01.784 [main] INFO com.greydev.notionbackup.NotionClient - downloadLink could not be extracted Exception in thread "main" java.lang.IllegalStateException: Could not export notion file at com.greydev.notionbackup.NotionBackup.lambda$main$0(NotionBackup.java:47) at java.base/java.util.Optional.orElseThrow(Optional.java:408) at com.greydev.notionbackup.NotionBackup.main(NotionBackup.java:47)

jckleiner commented 2 years ago

Yes, it will be shown in your console, when you start the program. But I did not have that problem when I did an export once or twice a day. Only when I'm testing and doing like 6-7 export in an hour, then Notion will complain.

I think you are still running the old docker image. I forgot to tell, since I've pushed a new image to DockerHub, you need to do a docker pull jckleiner/notion-backup to get the new image version to your machine. As far as i know, by default, if Docker finds the image (jckleiner/notion-backup) on your local machine, it will not check if a newer version exists in DockerHub. So a manual pull is needed.

Also, do you get an email to your Notion email address that your export is ready?

damienreyre commented 2 years ago

Hello,

Yes, you were right. I didn't get the new version. Everything is fine now!

I have tested for local, cloud and GitHub.

Thanks a lot for your time. I do appreciate.

Have a good day.

Damien

damienreyre commented 2 years ago

Hello again,

Since 5 days, my job failed all the times. I think that's because my backup is around 200 MB or the time is too long for backuping now...

Cheers

jckleiner commented 2 years ago

Hello, Notion changed their API on 27.05.2022 and does not allow non-human login requests anymore. That's why the tool can't login and fails. I will try to find a workaround soon and will update the project.

damienreyre commented 2 years ago

Ok. Thanks for the information.

DavideTedesco commented 2 years ago

Hi @jckleiner have you found a solution for the new API version released on 27.05.2022? I'm having a similar error (like @damienreyre) using Github Actions, here are the logs:

22:06:19.149 [main] INFO com.greydev.notionbackup.NotionClient - Notion API workspace export 'state': 'in_progress', Pages exported so far: 2189
22:06:25.149 [main] INFO com.greydev.notionbackup.NotionClient - Notion workspace export failed. After 10 minutes, the export status from the Notion API response was still not 'success'
22:06:25.150 [main] INFO com.greydev.notionbackup.NotionClient - downloadLink could not be extracted
Error: Exception in thread "main" java.lang.IllegalStateException: Could not export notion file
    at com.greydev.notionbackup.NotionBackup.lambda$main$0(NotionBackup.java:49)
    at java.base/java.util.Optional.orElseThrow(Optional.java:408)
    at com.greydev.notionbackup.NotionBackup.main(NotionBackup.java:49)
Error: Process completed with exit code 1.
damienreyre commented 2 years ago

Hi, same for me. I'm always looking for a solution to backup my Notion.

jckleiner commented 2 years ago

I will take a look at that problem next week.

DavideTedesco commented 2 years ago

I actually solved the problems I was mentioning above with the export of the file, just by incrementing the number of cycles that the NotionClient has to wait (in this commit on my fork). The problem that I'm encountering now is different, since the zip file that I obtain is too big to be uploaded (approximately 4.7 GB) it will fail to upload to Nextcloud with this log:

23:28:37.503 [Thread-2] INFO com.greydev.notionbackup.cloudstorage.nextcloud.NextcloudClient - Nextcloud: uploading file 'notion-export-markdown_2022-08-21_23-26-50.zip' ...
23:29:08.074 [Thread-2] INFO com.greydev.notionbackup.cloudstorage.nextcloud.NextcloudClient - Nextcloud: Unknown Nextcloud response code: '413'

The 413 code is known to be "Request Entity Too Large".

I was thinking about splitting the zip file into 25 MB zip files via this library and upload them to Nextcloud . What do you think about it @jckleiner? It could be possibly be called from the NotionBackup class after it obtains the exported zip file, making the whole program reliable and useful even for larger Notion workspaces!

damienreyre commented 2 years ago

@jckleiner Any news?

jckleiner commented 2 years ago

@DavideTedesco glad that you were able to solve the first problem. I will also increase that timeout.

The problem which arised from the API changes from 27.05.2022 was that Notion's API didn't allow programatic logins for some days which broke the backup but that was then fixed some days later by Notion (I assume).

To your second question: I've never tested Nexcloud with WebDAV with such a large export file but your solution sounds good. I'd be happy if you want to create a PR for that! If not, then I'm also not sure if and when I'd be able to implement that feature.

jckleiner commented 2 years ago

@damienreyre I've increased the timeout like DavideTedesco did. I hope this will fix your problem. Can you test your backup again and let me know?

damienreyre commented 2 years ago

Yeah, I just have tried and it's OKay now. Thanks guys.