Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-8941

[AI] Missing error handling- in case of wrong api key -> 500 appears

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 4.6.10
    • None

    Description

      Prerequisites:
      Configure a wrong api key for openai.
      Have an action config prepared.

      Steps to reproduce:
      1. Start creating an Image CT
      2. Add an image
      3. Click on 'Use AI' button

      Actual result:
      500 error appears:

      {
          "ErrorMessage": {
              "_media-type": "application\/vnd.ibexa.api.ErrorMessage+json",
              "errorCode": 500,
              "errorMessage": "Internal Server Error",
              "errorDescription": "Incorrect API key provided: sk-svcac***************************************************dupa. You can find your API key at https:\/\/platform.openai.com\/account\/api-keys.",
              "trace": "#0 \/Users\/ts\/ibexacomm7\/vendor\/openai-php\/client\/src\/Transporters\/HttpTransporter.php(57): OpenAI\\Transporters\\HttpTransporter->throwIfJsonError(Array, '{\\n    \"error\": ...')\n#1 \/Users\/ts\/ibexacomm7\/vendor\/openai-php\/client\/src\/Resources\/Chat.php(33): OpenAI\\Transporters\\HttpTransporter->requestObject(Object(OpenAI\\ValueObjects\\Transporter\\Payload))\n#2 \/Users\/ts\/ibexacomm7\/vendor\/ibexa\/connector-openai\/src\/lib\/ActionHandler\/ImageToTextActionHandler.php(55): OpenAI\\Resources\\Chat->create(Array)\n#3 \/Users\/ts\/ibexacomm7\/vendor\/ibexa\/connector-ai\/src\/lib\/ActionService.php(67): Ibexa\\ConnectorOpenAi\\ActionHandler\\ImageToTextActionHandler->handle(Object(Ibexa\\Contracts\\ConnectorAi\\Action\\GenerateAltTextAction))\n#4 \/Users\/ts\/ibexacomm7\/vendor\/ibexa\/connector-ai\/src\/lib\/Event\/ActionServiceEventDecorator.php(46): Ibexa\\ConnectorAi\\ActionService->execute(Object(Ibexa\\Contracts\\ConnectorAi\\Action\\GenerateAltTextAction), Object(Ibexa\\ConnectorAi\\ActionConfiguration), Object(Ibexa\\ConnectorOpenAi\\ActionHandler\\ImageToTextActionHandler))\n#5 \/Users\/ts\/ibexacomm7\/vendor\/ibexa\/connector-ai\/src\/bundle\/Controller\/REST\/ActionController.php(54): Ibexa\\ConnectorAi\\Event\\ActionServiceEventDecorator->execute(Object(Ibexa\\Contracts\\ConnectorAi\\Action\\GenerateAltTextAction), Object(Ibexa\\ConnectorAi\\ActionConfiguration))\n#6 \/Users\/ts\/ibexacomm7\/vendor\/symfony\/http-kernel\/HttpKernel.php(163): Ibexa\\Bundle\\ConnectorAi\\Controller\\REST\\ActionController->executeAction(Object(Symfony\\Component\\HttpFoundation\\Request), Object(Ibexa\\ConnectorAi\\ActionConfiguration))\n#7 \/Users\/ts\/ibexacomm7\/vendor\/symfony\/http-kernel\/HttpKernel.php(75): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#8 \/Users\/ts\/ibexacomm7\/vendor\/symfony\/http-kernel\/Kernel.php(202): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#9 \/Users\/ts\/ibexacomm7\/vendor\/symfony\/runtime\/Runner\/Symfony\/HttpKernelRunner.php(35): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#10 \/Users\/ts\/ibexacomm7\/vendor\/autoload_runtime.php(35): Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner->run()\n#11 \/Users\/ts\/ibexacomm7\/public\/index.php(5): require_once('\/Users\/ts\/ibexa...')\n#12 {main}",
              "file": "\/Users\/ts\/ibexacomm7\/vendor\/openai-php\/client\/src\/Transporters\/HttpTransporter.php",
              "line": 131
          }
      }
      

      Expected result:
      This error should be handled/ be clear to the user.

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              tomasz.szopinski@ibexa.co Tomasz SzopiƄski
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: