Maakaf/friends-activity-backend

Fix Deprecated Octokit API and 422 Error in GitHub Search

Open

#57 opened on Oct 31, 2025

 (2 comments) (0 reactions) (1 assignee)TypeScript (17 forks)auto 404
buggood first issuehacktoberfest

Repository metrics

Stars
 (9 stars)
PR merge metrics
 (PR metrics pending)

Description

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

Contributor guide