trendoraai / notion-super-tags

Supertags for Notion - Consolidate and view (super)tagged blocks from various pages in a single place.
MIT License
1 stars 1 forks source link

What happens if we get 500 (internal server error) #28

Open trendoraai opened 8 months ago

trendoraai commented 8 months ago

Supertag _thinking is not in database.
Supertag _thinking is not in database.
Supertag _supertags is not in database.
Supertag _food is not in database.
Supertag _framework is not in database.
Supertag _business is not in database.
Traceback (most recent call last):
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/notion_client/client.py", line 118, in _parse_response
    response.raise_for_status()
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/httpx/_models.py", line 758, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'https://api.notion.com/v1/blocks/ea787bd6-29f0-4d8b-925a-3a750963bae3/children'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/pb/projects/notion-super-tags/src/tagz/__main__.py", line 67, in <module>
    main()
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/projects/notion-super-tags/src/tagz/__main__.py", line 51, in main
    synced_wrapper = block.create_original_synced_block()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/projects/notion-super-tags/src/tagz/block.py", line 193, in create_original_synced_block
    blocks_after_above_block = self.notion.blocks.children.append(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/notion_client/api_endpoints.py", line 23, in append
    return self.parent.request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/notion_client/client.py", line 194, in request
    return self._parse_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pb/.pyenv/versions/notion-super-tags/lib/python3.11/site-packages/notion_client/client.py", line 126, in _parse_response
    raise APIResponseError(response, body["message"], code)
notion_client.errors.APIResponseError: Unexpected error occurred.
trendoraai commented 8 months ago

I should add better logs which help me debug. Basic things I need to know for debugging are:

  1. It failed for which page.
  2. It failed for which block.
trendoraai commented 8 months ago

May be it happened because a lot of requests/rate limit?

trendoraai commented 8 months ago

It got fixed on a re-run. Most likely something went wrong because of a lot of requests. Is there a way to monitor how many requests were sent (some Python package)?