Errors returned from AI GW direct_access_token to be logged

What does this MR do and why?

Addressing missing exceptions from AI GW direct_access_token calls.

This issue gives more context: #547431 (closed)

How to set up and validate locally

NOTE: These steps are just to validate the the functionality is working as expected. But the final validation will be when we see the Exceptions being logged to Kibana, as indicated in the related issue.

Testing that the functionality still works. In GDK with AI GW enabled and running

curl -i --request POST \
  --header "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
  --url "http://gdk.test:3000/api/v4/code_suggestions/direct_access"

Should still return the Direct Access Token in JSON format

When things are going wrong

  1. In AI GW code ai_gateway/api/v1/code/user_access_token.py try to add some faulty code. For example, calling a function that doesn't exist foobar()
  2. Repeat the curl command. You should get such response.
HTTP/1.1 503 Service Unavailable
Content-Length: 35
Date: Thu, 05 Jun 2025 15:25:59 GMT
Content-Type: application/json
Cache-Control: no-cache
.....

{"message":"Token creation failed"}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #547431 (closed)

Edited by Omar Qunsul

Merge request reports

Loading