Skip to content

Fixing API request failed Error#215

Open
ishree-dev wants to merge 1 commit into
google:mainfrom
ishree-dev:fix
Open

Fixing API request failed Error#215
ishree-dev wants to merge 1 commit into
google:mainfrom
ishree-dev:fix

Conversation

@ishree-dev
Copy link
Copy Markdown
Contributor

This PR resolves a "404 Not Found" API error encountered when calling the Chronicle API's runAnalysis endpoint from the trigger_github_checks function.

Problem:

The runAnalysis API call was failing with a 404 error when list_parsers successfully returned one or more parsers for a given log_type. The error message indicated a duplicated segment in the URL path, specifically the projects/{project}/locations/{location}/instances/{instance} part.

Root Cause:

The list_parsers function returns parser objects where the "name" field contains the full resource path (e.g., projects/P/locations/L/instances/I/logTypes/LT/parsers/PA). In the original implementation, this full name was being used in conjunction with a base URL construction in chronicle_request that already included the instance path. This led to the instance path being duplicated in the final request URL sent to the Chronicle API.

Solution:

The trigger_github_checks function has been updated to correctly construct the endpoint_path for the runAnalysis call:

Extract Parser ID: When list_parsers returns one or more parsers, the code now extracts only the parser_id from the "name" field of the first parser.
Relative Endpoint Path: The endpoint_path is now consistently built using the format logTypes/{log_type}/parsers/{parser_id}:runAnalysis. This path is relative to the Chronicle instance.
Fallback Consistency: The fallback case, where list_parsers finds no parsers, already used a relative path (logTypes/{log_type}/parsers/-:runAnalysis), so the updated logic aligns with this structure.

@ishree-dev ishree-dev requested a review from prachib29 as a code owner May 20, 2026 09:55
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