richartkeil / notion-guardian Goto Github PK
View Code? Open in Web Editor NEW๐กโ๏ธ Keeps your Notion workspace safe and version controlled at all times.
License: MIT License
๐กโ๏ธ Keeps your Notion workspace safe and version controlled at all times.
License: MIT License
Hey @richartkeil, just wanted to ping you that I've finished my improvements to the script:
recursive
option)await
https://github.com/upleveled/notion-backup
Feel free to take anything that is useful! (and close this issue whenever you like) Happy to answer any questions too.
Credited you at the bottom too, because your script proved to be a great basis for writing this.
Hi @richartkeil
I have been using a fork of notion-guardian (notion-backup), but since yesterday the backup has been failing with this error:
AxiosError: Request failed with status code 400
Details (sanitized) - I'm not sure if this is what you need or not:
headers: AxiosHeaders {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
Cookie: 'token_v2=***',
'User-Agent': 'axios/1.3.5',
'Content-Length': '197',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
baseURL: 'https://www.notion.so/api/v3',
method: 'post',
url: 'enqueueTask',
data: '{"task":{"eventName":"exportBlock","request":{"blockId":"xxxxxxxx-xxxx-x[xx](https://github.com/alice-rosen/notion-dphil-automated/actions/runs/xxxxxxxxxx/jobs/xxxxxxxxxx#step:6:43)x-xxxx-xxxxxxxxxxxx","exportOptions":{"exportType":"markdown","locale":"en","timeZone":"Europe/Vienna"},"recursive":true}}}'
},
And response details:
response: {
status: 400,
statusText: 'Bad Request',
Apologies, this is my first time posting an issue, so please let me know if you need more info. Let me know if you have any ideas or if there is anything not too complicated I could try :)
Hi @richartkeil ๐ Hope you are well.
Recently, our daily Notion backups (using our notion-backup
fork of notion-guardian
) started failing with an HTTP 403 status code:
AxiosError: Request failed with status code 403
We have had no code changes in the last 5 days, and the daily backups have succeeded until today (eg. yesterday's backup succeeded).
I originally also tried updating the token (which I thought was the problem originally) but this did not change the error.
Relevant request details (sanitized):
request: ClientRequest {
method: 'GET',
headers: {
Accept: 'application/json, text/plain, */*',
Cookie: 'token_v2=***',
'User-Agent': 'axios/1.3.4',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
protocol: 'https:',
hostname: 'file.notion.so',
path: '/f/t/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/Export-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.zip?id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx&table=user_export&expirationTimestamp=1680167194467&signature=xxxxxxxxxx_xxxxxxxx-xxxxxxxxxxxxxxxxxx&download=true&downloadName=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx%2FExport-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.zip',
baseURL: 'https://www.notion.so/api/v3',
}
And response details:
response: {
status: 403,
statusText: 'Forbidden',
And axios
config:
config: {
baseURL: 'https://www.notion.so/api/v3',
method: 'get',
url: 'https://file.notion.so//f/t/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/Export-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.zip?id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx&table=user_export&expirationTimestamp=1680167194467&signature=xxxxxxxxxx_xxxxxxxx-xxxxxxxxxxxxxxxxxx&download=true&downloadName=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx%2FExport-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.zip',
responseType: 'stream',
data: undefined
},
I'm guessing because of the responseType: 'stream'
in the error message, it probably has to do with this code here:
Lines 72 to 76 in 80135ac
Maybe Notion changed their internal API?
Hi, thank you for your work! I am an ordinary user, I don't code so I don't know how to fix this. I followed all your steps and I trigged the workflow three times by modifying the README and they all stopped here after repeating "exported 302 pages" 352 lines. Is here any solution? Thanks! I didn't do anything during the process of the backup workflow.
Did I miss anything? It's the ZIP file that is committed. I have to do the following to unzip. ๐๐ฝ
# Find the zip file using the wildcard
zip_file="$(ls *.zip | head -n1)"
# Unzip the file
unzip "$zip_file"
# Get the top-level folder
folder=$(unzip -Z1 "$zip_file" | awk -F/ '{print $1}' | sort | uniq)
# Move the contents of the first-level folder to the current directory
rsync "${folder%/}"/* .
# Remove the first-level folder
rm -r "${folder%/}"
# Delete the zip file
rm "$zip_file"
The export is working, but the action seems to have set the wait time too short.
It seemed that notion export zip file has sub zip archives if the export zip > 500 MB. I started to have this issue recently as the archive file size slowly increasing.
GitHub Action log:
[main 124f791] Automated Notion workspace backup
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 Export-***-Part-1.zip
remote: error: Trace: ***
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File Export-***-Part-1.zip is 498.13 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com./
To https://github.com/***/***
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/***/***'
Error: Process completed with exit code 1.
It might be something about the extract function at
Line 95 in 80135ac
Line 2 in 80135ac
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.