Fix Deprecated Octokit API and 422 Error in GitHub Search
#57 创建于 2025年10月31日
仓库指标
- 星标
- (9 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
The application is using a deprecated Octokit method and receiving 422 errors when searching for GitHub issues and pull requests.
Issues Observed
1. Deprecated API Method
Current: Using octokit.rest.search.issuesAndPullRequests() Action Required: Migrate to the updated API method as per GitHub REST API documentation
2. HTTP 422 Errors
Multiple 422 (Unprocessable Entity) responses Possible causes: Invalid query parameter: advanced_search=true (not a valid GitHub API parameter) Malformed date format in the search query Invalid search qualifier combination
Tasks
- Replace deprecated octokit.rest.search.issuesAndPullRequests() with the current method
- Remove or fix the invalid advanced_search=true parameter
- Verify the date format in the created:>= qualifier matches GitHub's expected format (ISO 8601)
- Add error handling for 422 responses
- Test the updated search query with valid parameters
- Add logging to capture the specific validation errors from GitHub's API response
Suggested Fix
The search endpoint should use octokit.request() or the updated REST method without deprecated parameters:
Additional Notes
The error occurs consistently with a ~220-250ms response time Consider implementing retry logic with exponential backoff for failed requests Review GitHub's search API rate limits and secondary rate limits