darobin / notion-backup

Simple command to backup a Notion workspace
MIT License
425 stars 63 forks source link

Error: Request failed with status code 400 #39

Closed yang closed 8 months ago

yang commented 8 months ago

Thanks for releasing this!

Ever seen / any ideas about this 400 error?

...
Pages exported: 558
Pages exported: 558
Pages exported: 558
Error: Request failed with status code 400
    at createError (/Users/yang/proj/mono/sandbox/notion-exp/notion-backup/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/yang/proj/mono/sandbox/notion-exp/notion-backup/node_modules/axios/lib/core/settle.js:17:12)
    at RedirectableRequest.handleResponse (/Users/yang/proj/mono/sandbox/notion-exp/notion-backup/node_modules/axios/lib/adapters/http.js:231:9)
    at RedirectableRequest.emit (node:events:514:28)
    at RedirectableRequest._processResponse (/Users/yang/proj/mono/sandbox/notion-exp/notion-backup/node_modules/follow-redirects/index.js:403:10)
    at RedirectableRequest._onNativeResponse (/Users/yang/proj/mono/sandbox/notion-exp/notion-backup/node_modules/follow-redirects/index.js:57:10)
    at Object.onceWrapper (node:events:629:26)
    at ClientRequest.emit (node:events:514:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17) {
  config: {
    url: 'https://file.notion.so/f/t/d374fab0-b9f1-4e7a-b5e2-2328aca3b7d8/Export-eae043bb-1074-4aa0-81e1-cf33c8779fb4.zip?id=2cf9c565-dca6-40f8-8692-11e23bde7797&table=user_export&spaceId=&expirationTimestamp=1711651328435&signature=EkjU7P1S3xqkEI5ctuy_o219zt3Q8xqxtx6IIfg4TIo&download=true&downloadName=d344fab0-b8f1-4e7a-b5e2-2328aca3b7d8%2FExport-eae0c3bb-1074-4a80-81e1-cf33c8779fb4.zip',
    method: 'get',
...
  response: {
    status: 400,
    statusText: 'PermissionCheckError',
    headers: {
      'content-length': '205',
      connection: 'close',
      server: 'CloudFront',
      date: 'Thu, 21 Mar 2024 07:35:33 GMT',
      location: 'https://www.notion.so/login',
      'x-cache': 'Miss from cloudfront',
      via: '1.1 7bd77f679e52167da498bb1812108688.cloudfront.net (CloudFront)',
      'x-amz-cf-pop': 'SFO5-C1',
      'x-amz-cf-id': 'hzFL2cOJUHFqfN8Oppe6cD14vsEAtkKn7GWAoDZCeZ7MQcCddxV_Vw==',
      'content-security-policy': "default-src 'none'; media-src 'self'; style-src 'unsafe-inline'"
    },
...

When I visit that URL in my (logged-in) browser I can download it. (It is the actual export.)

yang commented 8 months ago

It was because my file token was a few chars truncated somehow :)