Skip to content

Fixing API request failed Error#215

Merged
mihirvala08 merged 2 commits into
google:mainfrom
ishree-dev:fix
May 22, 2026
Merged

Fixing API request failed Error#215
mihirvala08 merged 2 commits 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
@ishree-dev ishree-dev force-pushed the fix branch 2 times, most recently from f73f860 to d7c413f Compare May 20, 2026 22:23
@mihirvala08 mihirvala08 self-requested a review May 21, 2026 06:44
@ishree-dev ishree-dev requested a review from tarunz May 21, 2026 08:24
@prachib29
Copy link
Copy Markdown
Collaborator

/run-integration-tests d7c413f

@prachib29
Copy link
Copy Markdown
Collaborator

/run-integration-tests c51c248

@mihirvala08 mihirvala08 merged commit 124b94a into google:main May 22, 2026
10 checks passed
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.

4 participants