seratch / notion-translator

CLI tool to translate Notion pages into a different language
MIT License
70 stars 20 forks source link

trouble defining the parent.database_id and cover.external #9

Open defi4wealt opened 1 year ago

defi4wealt commented 1 year ago

Based on the error message, it seems like there is an issue with the notion-translator tool when creating a new translated page in the Notion database. The error indicates that the script is having trouble defining the parent.database_id and cover.external properties when creating the new page.

Here the issue from the terminal:

"APIResponseError: body failed validation. Fix one:
body.parent.database_id should be defined, instead was `undefined`.
body.cover.external should be defined, instead was `undefined`.
    at buildRequestError (/Users/niko/NotionDeepl/notion-translator-main/node_modules/@notionhq/client/build/src/errors.js:162:16)
    at Client.request (/Users/niko/NotionDeepl/notion-translator-main/node_modules/@notionhq/client/build/src/Client.js:304:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async createNewPageForTranslation (/Users/niko/NotionDeepl/notion-translator-main/index.js:391:27)
    at async /Users/niko/NotionDeepl/notion-translator-main/index.js:426:19 {
  code: 'validation_error',
  status: 400,
  headers: Headers {
    [Symbol(map)]: [Object: null prototype] {
      date: [ 'Sun, 26 Mar 2023 16:11:30 GMT' ],
      'content-type': [ 'application/json; charset=utf-8' ],
      'content-length': [ '236' ],
      connection: [ 'close' ],
      'set-cookie': [
        'notion_browser_id=b11f3ded-67b1-4e4b-ad47-d5e36867d58d; Domain=www.notion.so; Path=/; Expires=Mon, 25 Mar 2024 16:11:30 GMT; Secure',
        'notion_check_cookie_consent=true; Domain=www.notion.so; Path=/; Expires=Mon, 27 Mar 2023 16:11:30 GMT; Secure',
        '__cf_bm=yFYSN9yx_uuFy.ar3p3yyT6QI2We1A9K8Lbc88IlSMg-1679847090-0-AeR+uPi7wDTixgYjiQHF61vwRzRn1ClqP1SdkPpgcM9eLMKSSDinssX2XtKA1oMsZ9OgsvSJ7U1qlHG0I7xF30I=; path=/; expires=Sun, 26-Mar-23 16:41:30 GMT; domain=.notion.com; HttpOnly; Secure; SameSite=None'
      ],
      'content-security-policy': [
        "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com https://cdn.amplitude.com https://api.amplitude.com http://dev-embed.notion.co http://embed.notion.co https://widget.intercom.io https://js.intercomcdn.com https://static.zdassets.com https://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://analytics.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com https://embed.typeform.com https://admin.typeform.com https://public.profitwell.com https://static.profitwell.com js.sentry-cdn.com https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com https://accounts.google.com https://www.googletagmanager.com https://www.googleadservices.com https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com https://client.mutinycdn.com https://user-data.mutinycdn.com https://cdn.metadata.io https://platformapi.metadata.io https://d2hrivdxn8ekm8.cloudfront.net https://d1lu3pmaz2ilpx.cloudfront.net https://dvqigh9b7wa32.cloudfront.net https://d330aiyvva2oww.cloudfront.net https://cdn.transcend.io https://cdn01.boxcdn.net https://cdn.sprig.com assets.customer.io code.gist.build https://www.google.com https://www.gstatic.com https://challenges.cloudflare.com;connect-src 'self' data: blob: https://msgstore.www.notion.so wss://msgstore.www.notion.so ws://localhost:* ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com https://cdn.amplitude.com https://api.amplitude.com https://www.notion.so https://api.embed.ly http://dev-embed.notion.co http://embed.notion.co https://js.intercomcdn.com https://api-iam.intercom.io https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io https://ekr.zdassets.com https://ekr.zendesk.com\t https://makenotion.zendesk.com\t https://api.smooch.io\t wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io https://accounts.google.com https://oauth2.googleapis.com https://www.googletagmanager.com https://analytics.google.com https://www.googleadservices.com https://googleads.g.doubleclick.net https://region1.google-analytics.com https://region1.analytics.google.com https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com https://client.mutinycdn.com https://user-data.mutinycdn.com https://cdn.metadata.io https://platformapi.metadata.io https://d2hrivdxn8ekm8.cloudfront.net https://d1lu3pmaz2ilpx.cloudfront.net https://dvqigh9b7wa32.cloudfront.net https://d330aiyvva2oww.cloudfront.net https://cdn.transcend.io https://telemetry.transcend.io https://api.statuspage.io https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so https://file.notion.so notion://file.notion.so https://api.box.com https://*.mux.com https://api.sprig.com https://storage.googleapis.com https://cdn.sprig.com https://cdn.userleap.com track.customer.io *.api.gist.build *.cloud.gist.build;font-src 'self' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com https://cdn01.boxcdn.net;img-src 'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com https://region1.google-analytics.com https://region1.analytics.google.com https://file.notion.so notion://file.notion.so https://*.mux.com track.customer.io;style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://github.githubassets.com https://js.chilipiper.com https://platform.twitter.com https://ton.twimg.com https://accounts.google.com https://cdn.transcend.io https://cdn01.boxcdn.net code.gist.build;media-src blob: https: http: https://file.notion.so notion://file.notion.so https://*.mux.com;worker-src blob:;frame-src https: http: https://accounts.google.com renderer.gist.build code.gist.build https://challenges.cloudflare.com"
      ],
      'x-dns-prefetch-control': [ 'off' ],
      'x-frame-options': [ 'SAMEORIGIN' ],
      'strict-transport-security': [ 'max-age=5184000; includeSubDomains' ],
      'x-download-options': [ 'noopen' ],
      'x-content-type-options': [ 'nosniff' ],
      'x-permitted-cross-domain-policies': [ 'none' ],
      'referrer-policy': [ 'strict-origin-when-cross-origin' ],
      'x-xss-protection': [ '0' ],
      etag: [ 'W/"ec-EhHVZ1tON7w2DDfjFYqnQsN7EIs"' ],
      vary: [ 'Accept-Encoding' ],
      'cf-cache-status': [ 'DYNAMIC' ],
      server: [ 'cloudflare' ],
      'cf-ray': [ '7ae0ab7559531621-DUS' ]
    }
  },
  body: '{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\\nbody.parent.database_id should be defined, instead was `undefined`.\\nbody.cover.external should be defined, instead was `undefined`."}'
}
seratch commented 1 year ago

Thanks for sharing this. If anyone knows how to fix it, happy to merge a fix!