Log other error codes in addition to 400.

Created on 14 February 2024, 5 months ago
Updated 10 April 2024, 3 months ago

Currently only 400 error codes are logged however this means it can be hard to understand what the issue is if something goes wrong on production. You will get a SearchApiException but no context about why.

We should log all error codes greater than 400.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

achap 🇦🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @achap
  • Merge request !42Catch 503 errors → (Merged) created by achap
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    Composer require failure
  • Pipeline finished with Failed
    5 months ago
    Total: 43s
    #94516
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 5 months ago
    Composer require failure
  • Status changed to Needs review 5 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 3 months ago
    Composer require failure
  • Pipeline finished with Failed
    3 months ago
    Total: 43s
    #129213
  • Issue was unassigned.
  • achap 🇦🇺

    Just ran into another error code from our remote service (429) so thought I would attempt to make this a little bit more flexible rather than just logging specific error codes. Unfortunately I couldn't find much documentation on OpenSearch error responses so it's a little hard to test.

    This error response from OpenSearch:

    Array
    (
        [_index] => index_a
        [_id] => entity:node/152691:en-AU
        [status] => 429
        [error] => Array
            (
                [type] => status_exception
                [reason] => Error from remote service: {
        "error": {
            "message": "You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.",
            "type": "insufficient_quota",
            "param": null,
            "code": "insufficient_quota"
        }
    }
            )
    )
    

    Ends up looking like this in the logs:

     Error from remote service: { "error": { "message": "Incorrect API key provided: foobar. You can find your API key at https://platform.openai.com/account/api-keys.", "type": "invalid_request_error", "param": null, "code": "invalid_api_key" } } for id: entity:node/189871:en-AU. Status code: 401
    

    I updated the log message to include the status code and also changed "for index" to "for id" since it is logging the id of the item not the index it's in.

    I'm getting some composer errors in my pipeline but I think it's unrelated to this change:

    $ composer install $COMPOSER_EXTRA
    No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
      Problem 1
        - drupal/core 10.2.x-dev conflicts with drush/drush <12.4.3.
        - drupal/core-recommended 10.2.x-dev requires drupal/core 10.2.x-dev -> satisfiable by drupal/core[10.2.x-dev].
        - Root composer.json requires drupal/core-recommended 10.2.x-dev -> satisfiable by drupal/core-recommended[10.2.x-dev].
        - Root composer.json requires drush/drush ^11.0 -> satisfiable by drush/drush[11.0.0-rc1, ..., 11.x-dev].
    
  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia

    kim.pepper made their first commit to this issue’s fork.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 3 months ago
    Composer require failure
  • Status changed to Fixed 3 months ago
  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia

    Committed to 2.x. Thanks!

  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024