seratch / notion-translator

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

what do these errors mean? #5

Open m4th3w561 opened 1 year ago

m4th3w561 commented 1 year ago

Fir of all, I want to thank the developers of notion-translator, it's been a time saver for me.

about my errors: I keep getting this error every now and then. I'd appreciate it if someone can show me how to fix this error.

body.parent.database_id should be defined, instead was `undefined`.
body.icon.emoji should be defined, instead was `undefined`.
body.icon.external should be defined, instead was `undefined`.
seratch commented 1 year ago

-d option prints more detailed information. If you can share the outputs, I may be able to figure out the cause of your situation.

m4th3w561 commented 1 year ago

Thank you for responding! I tried the debugging option and it shows a lot of objects. Is there a certain value or key that I should find to share with you? The outputs are very very long...

m4th3w561 commented 1 year ago
@notionhq/client warn: request fail {
  code: 'validation_error',
  message: 'body failed validation. Fix one:\n' +
    'body.parent.database_id should be defined, instead was `undefined`.\n' +
    'body.icon.emoji should be defined, instead was `undefined`.\n' +
    'body.icon.external should be defined, instead was `undefined`.'
}
@notionhq/client debug: failed response body {
  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.icon.emoji should be defined, instead was `undefined`.\\nbody.icon.external should be defined, instead was `undefined`."}'
}
C:\Users\...\notion-translator\node_modules\@notionhq\client\build\src\errors.js:162
        return new APIResponseError({
               ^

APIResponseError: body failed validation. Fix one:
body.parent.database_id should be defined, instead was `undefined`.
body.icon.emoji should be defined, instead was `undefined`.
body.icon.external should be defined, instead was `undefined`.
    at buildRequestError (C:\Users\...\notion-translator\node_modules\@notionhq\client\build\src\errors.js:162:16)
    at Client.request (C:\Users\...\notion-translator\node_modules\@notionhq\client\build\src\Client.js:304:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async createNewPageForTranslation (C:\Users\...\notion-translator\index.js:391:27)
    at async C:\Users\...\notion-translator\index.js:426:19 { 
  code: 'validation_error',
  status: 400,
  headers: Headers {
    [Symbol(map)]: [Object: null prototype] {
      date: [ 'Tue, 14 Feb 2023 04:48:02 GMT' ],
      'content-type': [ 'application/json; charset=utf-8' ],
      'content-length': [ '296' ],
      connection: [ 'close' ],
      'set-cookie': [
        'notion_browser_id=61e75368-2f09-4437-8f1f-473a46ee8570; Domain=www.notion.so; Path=/; Expires=Wed, 14 Feb 2024 04:48:02 GMT; Secure',
        'notion_check_cookie_consent=false; Domain=www.notion.so; Path=/; Expires=Wed, 15 Feb 2023 04:48:02 GMT; Secure',
        '__cf_bm=7OD9HR.2XLZXgIIUCStww7uUf8xsdB8e0F7k9bj0tBw-1676350082-0-AZRDFZLbNF/EUekPSORnka8F9LKOvv9IZLOXBYEjZysCG3Axwy6/Ul1TtuaAM4s67Oz76cX9x8ml0qYB7OFeCjI=; path=/; expires=Tue, 14-Feb-23 05:18:02 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://www.google.com https://www.gstatic.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;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;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;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;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"
      ],
      '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/"128-qrsYeAEP37hqz64nd6FvWCUYnQM"' ],
      vary: [ 'Accept-Encoding' ],
      'cf-cache-status': [ 'DYNAMIC' ],
      server: [ 'cloudflare' ],
      'cf-ray': [ '79932b4c9d922636-NRT' ]
    }
  },
  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.icon.emoji should be defined, instead was `undefined`.\\nbody.icon.external should be defined, instead was `undefined`."}'
}
clementduveau commented 1 year ago

Same problem here. I am pretty sure that the logic changed in the API.

We need to change the create page method (line 391) to include the ID of the current page.

What I don't know is if we need to delete the appending too. I will try.

seratch commented 1 year ago

Hey @clementduveau, thanks for sharing this. If you are confident about the necessary change to resolve this issue, can you send a pull request for it?

clementduveau commented 1 year ago

Working on it as we speak.

In a fork from @okada-em, he changed that

The code is very different as the purpose is different, but it tends to prove that it should fix everything.

I will send a pull request to fix just that. As I am not very aware of how the code works, I will let you run all tests/verification for it.

seratch commented 1 year ago

I haven't checked @~okada-em's changes at all. As long as your change resolves the issue, plus it does not change this package's behavior at all, I am happy to merge the change. I don't have the bandwidth to maintain this project in a timely manner. So, if you want to fork this project as a your active project, it's totally fine too!

clementduveau commented 1 year ago

OK, so I made some tweaks but it didn't change anything.

@m4th3w561 , is this bug happening always on the same pages ? I found a page where it is happening everytime for me but I can't figure why. It's clearly a type page, not a database...

I will try to add more debug on create page to understand.