Skip to content

Fix: Handle missing space information in Notion API response #1336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

xiaoker
Copy link

@xiaoker xiaoker commented May 25, 2025

The /api/v3/loadUserContent endpoint for Notion may not return space information. This change updates the getRepositories method in NotionDocumentService to check if userContent.recordMap.space is undefined. If it is, an empty array is returned, preventing the "Cannot convert undefined or null to object" error.

A new test case has been added to src/common/backend/services/notion/service.test.ts to verify this behavior. The test mocks getUserContent to return a response without space information and asserts that getRepositories returns an empty array.

The /api/v3/loadUserContent endpoint for Notion may not return space information. This change updates the `getRepositories` method in `NotionDocumentService` to check if `userContent.recordMap.space` is undefined. If it is, an empty array is returned, preventing the "Cannot convert undefined or null to object" error.

A new test case has been added to `src/common/backend/services/notion/service.test.ts` to verify this behavior. The test mocks `getUserContent` to return a response without space information and asserts that `getRepositories` returns an empty array.
Here's what I've done so far:

1.  **Fix for Notion API:** I've addressed an issue where space information might be missing from the Notion API response. I've updated the code to handle this gracefully by checking for undefined space data and returning an empty array for repositories if it's missing. I also added a unit test for this scenario.

2.  **Chrome Extension Build Debugging (In Progress):**
    *   I looked into why the command to build the Chrome extension wasn't producing the packaged file.
    *   I discovered that the build script wasn't outputting files to the correct directory.
    *   As an initial debugging step, I temporarily disabled a part of the webpack configuration that cleans the output directory, thinking it might be interfering. However, this didn't solve the problem.

The build process is still failing silently. My next step was to modify the build script to provide more detailed information about what's happening during the build, to help pinpoint the cause of the failure.
@DiamondYuan DiamondYuan merged commit 5e30d9d into webclipper:master Jun 4, 2025
@DiamondYuan
Copy link
Member

ai 写的完全是错的。。。。。。。。

@xiaoker
Copy link
Author

xiaoker commented Jun 5, 2025

ai 写的完全是错的。。。。。。。。

完全不懂代码,尝试了一下。谢谢你

@xiaoker
Copy link
Author

xiaoker commented Jun 23, 2025

还出现了一个情况,就是只能选择最新创建的2个工作空间,绑定账号的时候。可是这样,我最早创建的工作空间就选择不到了。。。

@xiaoker
Copy link
Author

xiaoker commented Jun 23, 2025

ai写的完全是错的。。。。。。。

最新版本还出现了一个情况,就是只能选择最新创建的2个工作空间,绑定账号的时候。可是这样,我最早创建的工作空间就选择不到了。。。能帮忙看看吗?谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants