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

   ### Current Behavior
   
   When attempting to retrieve plugin metadata for a non-existent plugin using 
the Admin API, the server returns a 500 Internal Server Error instead of 
properly handling the request.
   
   ```shell
   $ curl --location 
"http://localhost:9180/apisix/admin/plugin_metadata/file-logger"; --header 
"x-api-key: $APISIX_API_KEY"
   <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
   
   The API should return a 404 Not Found status with an appropriate JSON error 
message when querying metadata for a non-existent plugin, similar to other 
Admin API endpoints when resources are not found.
   
   Example expected response:
   ```json
   {
       "message": "Key not found"
   }
   ```
   
   ### Error Logs
   
   ```
   2025/09/17 10:17:52 [error] 320064#320064: *3867478 lua entry thread 
aborted: runtime error: /usr/local/apisix/apisix/admin/utils.lua:109: attempt 
to index local 'conf' (a nil value)
   stack traceback:
   coroutine 0:
           /usr/local/apisix/apisix/admin/utils.lua: in function 
'decrypt_params'
           /usr/local/apisix/apisix/admin/init.lua:242: in function 'handler'
           /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:1013: in 
function 'dispatch'
           /usr/local/apisix/apisix/init.lua:1032: in function 'http_admin'
           content_by_lua(nginx.conf:212):2: in main chunk, client: 127.0.0.1, 
server: , request: "GET /apisix/admin/plugin_metadata/file-logger HTTP/1.1", 
host: "localhost:9180"
   ```
   
   ### Steps to Reproduce
   
   1. Start APISIX 3.13 with default configuration
   2. Send a GET request to retrieve metadata for a non-existent plugin:
   ```bash
   curl --location 
"http://localhost:9180/apisix/admin/plugin_metadata/file-logger"; \
     --header "x-api-key: $APISIX_API_KEY"
   ```
   3. Observe the 500 error response instead of 404:
   ```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>
   ```
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.13.0
   - Operating system (run `uname -a`): Rocky Linux 8.10
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 
openresty/1.27.1.2
   


-- 
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