Error while calling API from Postman- (APP_DEBUG=true)

Error while calling API
I called the librenms API from postman with below details.

URL:
IP address/api/v0/devices/localhost/groups
Headers:
X-Auth-Token: token value taken from portal

but the response is 500 error with message
{
“message”: “Server Error: Set APP_DEBUG=true to see details.”
}

Please advise

I got the same error.

I noticed it as my oxidized integration failed since a while. I thought it’s an oxidized issue, reinstallen oxidized bit error remains.

So I took a look at the API.

Debug shows the following:

{
"message": "Undefined index: api_token",
"exception": "ErrorException",
"file": "/opt/librenms/app/Providers/TokenUserProvider.php",
"line": 66,
"trace": [
    {
        "file": "/opt/librenms/app/Providers/TokenUserProvider.php",
        "line": 66,
        "function": "handleError",
        "class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
        "type": "->"
    },
    {
        "file": "/opt/librenms/app/Providers/LegacyUserProvider.php",
        "line": 65,
        "function": "retrieveByCredentials",
        "class": "App\\Providers\\TokenUserProvider",
        "type": "->"
    },
    {
        "file": "/opt/librenms/app/Providers/TokenUserProvider.php",
        "line": 77,
        "function": "retrieveByLegacyId",
        "class": "App\\Providers\\LegacyUserProvider",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php",
        "line": 85,
        "function": "retrieveByCredentials",
        "class": "App\\Providers\\TokenUserProvider",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php",
        "line": 60,
        "function": "user",
        "class": "Illuminate\\Auth\\TokenGuard",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
        "line": 62,
        "function": "check",
        "class": "Illuminate\\Auth\\TokenGuard",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
        "line": 41,
        "function": "authenticate",
        "class": "Illuminate\\Auth\\Middleware\\Authenticate",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "Illuminate\\Auth\\Middleware\\Authenticate",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 104,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
        "line": 682,
        "function": "then",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
        "line": 657,
        "function": "runRouteWithinStack",
        "class": "Illuminate\\Routing\\Router",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
        "line": 623,
        "function": "runRoute",
        "class": "Illuminate\\Routing\\Router",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
        "line": 612,
        "function": "dispatchToRoute",
        "class": "Illuminate\\Routing\\Router",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
        "line": 176,
        "function": "dispatch",
        "class": "Illuminate\\Routing\\Router",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 30,
        "function": "Illuminate\\Foundation\\Http\\{closure}",
        "class": "Illuminate\\Foundation\\Http\\Kernel",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/darkghosthunter/larapoke/src/Http/Middleware/LarapokeGlobalMiddleware.php",
        "line": 18,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "DarkGhostHunter\\Larapoke\\Http\\Middleware\\LarapokeGlobalMiddleware",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/fideloper/proxy/src/TrustProxies.php",
        "line": 57,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "Fideloper\\Proxy\\TrustProxies",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
        "line": 21,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
        "line": 21,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
        "line": 27,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
        "line": 62,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 163,
        "function": "handle",
        "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
        "line": 53,
        "function": "Illuminate\\Pipeline\\{closure}",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
        "line": 104,
        "function": "Illuminate\\Routing\\{closure}",
        "class": "Illuminate\\Routing\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
        "line": 151,
        "function": "then",
        "class": "Illuminate\\Pipeline\\Pipeline",
        "type": "->"
    },
    {
        "file": "/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
        "line": 116,
        "function": "sendRequestThroughRouter",
        "class": "Illuminate\\Foundation\\Http\\Kernel",
        "type": "->"
    },
    {
        "file": "/opt/librenms/html/api_v0.php",
        "line": 55,
        "function": "handle",
        "class": "Illuminate\\Foundation\\Http\\Kernel",
        "type": "->"
    }
]

}

Sorry for my doublepost, but looks like I found the solution.

The API key from LibreNMS looks to be corrupted/outdated.

I created a new one and all works fine.

@munishase: Can you please verify?