elvus opened a new issue, #12292:
URL: https://github.com/apache/apisix/issues/12292

   ### Current Behavior
   
   Returns an error 500
   ```html
   <html>
   <head><title>500 Internal Server Error</title></head>
   <body>
   <center><h1>500 Internal Server Error</h1></center>
   <hr><center>openresty</center>
   <p><em>Powered by <a 
href="https://apisix.apache.org/";>APISIX</a>.</em></p></body>
   </html>
   ```
   
   ### Expected Behavior
   
   Get a success response
   
   ### Error Logs
   
   ```sh
   2025/06/06 22:34:59 [warn] 8#8: *12199 [lua] base.lua:49: phase_func(): 
failed to send request to AI service: failed to connect to LLM server: 20: 
unable to get local issuer certificate, client: 10.2.70.138, server: _, 
request: "POST /chat HTTP/1.1", host: "10.1.1.109"
   2025/06/06 22:34:59 [warn] 8#8: *12199 [lua] plugin.lua:1210: 
common_phase(): ai-proxy exits with http status code 500, client: 10.2.70.138, 
server: _, request: "POST /chat HTTP/1.1", host: "10.1.1.109"
   ```
   
   ### Steps to Reproduce
   
   1. Install Apisix by helm chart
      - https://charts.apiseven.com or 
      - https://charts.bitnami.com/bitnami
   2. Set your value file
   ```yaml
   apisix:
     ssl:
       ssl_trusted_certificate: system
   dashboard:
     enabled: true
   service:
     type: NodePort
   ingress-controller:
     enabled: true
     config:
       apisix:
         serviceName: apisix-admin
         adminAPIversion: v3
       kubernetes:
         enableGatewayAPI: true
   plugins:
     - real-ip
     - ai
     - client-control
     - proxy-control
     - request-id
     - zipkin
     - ext-plugin-pre-req
     - fault-injection
     - mocking
     - serverless-pre-function
     - cors
     - ip-restriction
     - ua-restriction
     - referer-restriction
     - csrf
     - uri-blocker
     - request-validation
     - chaitin-waf
     - multi-auth
     - openid-connect
     - cas-auth
     - authz-casbin
     - authz-casdoor
     - wolf-rbac
     - ldap-auth
     - hmac-auth
     - basic-auth
     - jwt-auth
     - jwe-decrypt
     - key-auth
     - consumer-restriction
     - attach-consumer-label
     - forward-auth
     - opa
     - authz-keycloak
     - proxy-cache
     - body-transformer
     - ai-prompt-template
     - ai-prompt-decorator
     - ai-prompt-guard
     - ai-rag
     - ai-rate-limiting
     - ai-proxy-multi
     - ai-proxy
     - ai-aws-content-moderation
     - proxy-mirror
     - proxy-rewrite
     - workflow
     - api-breaker
     - limit-conn
     - limit-count
     - limit-req
     - gzip
     - server-info
     - traffic-split
     - redirect
     - response-rewrite
     - degraphql
     - kafka-proxy
     - grpc-transcode
     - grpc-web
     - http-dubbo
     - public-api
     - prometheus
     - datadog
     - loki-logger
     - elasticsearch-logger
     - echo
     - loggly
     - http-logger
     - splunk-hec-logging
     - skywalking-logger
     - google-cloud-logging
     - sls-logger
     - tcp-logger
     - kafka-logger
     - rocketmq-logger
     - syslog
     - udp-logger
     - file-logger
     - clickhouse-logger
     - tencent-cloud-cls
     - inspect
     - example-plugin
     - aws-lambda
     - azure-functions
     - openwhisk
     - openfunction
     - serverless-post-function
     - ext-plugin-post-req
     - ext-plugin-post-resp
   stream_plugins:
     - ip-restriction
     - limit-conn
     - mqtt-proxy
     - syslog
   ```
   
   Create your ai route:
   ```sh
   curl "http://127.0.0.1:9180/apisix/admin/routes/1"; -X PUT \
     -H "X-API-KEY: ${ADMIN_API_KEY}" \
     -d '{
       "uri": "/anything",
       "plugins": {
         "ai-proxy": {
           "auth": {
             "header": {
               "Authorization": "Bearer <some-token>"
             }
           },
           "model": {
             "provider": "openai",
             "name": "gpt-4",
             "options": {
               "max_tokens": 512,
               "temperature": 1.0
             }
           }
         }
       },
       "upstream": {
         "type": "roundrobin",
         "nodes": {
           "somerandom.com:443": 1
         },
         "scheme": "https",
         "pass_host": "node"
       }
     }'
   ```
   Make a request:
   ```sh
   curl http://127.0.0.1:9080/anything -i -XPOST  -H 'Content-Type: 
application/json' -d '{
           "messages": [
               { "role": "system", "content": "You are a mathematician" },
               { "role": "user", "content": "What is 1+1?" }
           ]
       }'
   ```
   
   
   
   ### Environment
   
   - APISIX version: APISIX/3.12.0
   - Operating system: Linux apisix-data-plane-55566486d4-rbfhh 
5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 GNU/Linux
   - OpenResty / Nginx version: openresty/1.27.1.1
   - etcd version: 3.6.0
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version: 3.8.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to