Maakaf/friends-activity-backend

Fix Deprecated Octokit API and 422 Error in GitHub Search

開放

#57 建立於 2025年10月31日

 (2 則留言) (0 個反應) (1 位負責人)TypeScript (17 個分叉)auto 404
buggood first issuehacktoberfest

倉庫指標

星標
 (9 顆星)
PR 合併指標
 (30 天內沒有已合併 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

貢獻者指南