Internal Server Error (v 3) - Cachet\Http\Controllers\Api\MetricPointController::update does not exist.
Internal Server Error
PUT status.neiki.dev
PHP 8.3.16 — Laravel 11.39.1
Method Cachet\Http\Controllers\Api\MetricPointController::update does not exist.
vendor/laravel/framework/src/Illuminate/Routing/Controller.php :68
vendor/laravel/framework/src/Illuminate/Routing/Controller.php :54
vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php :44
I tried to put metrics points via put (apikey etc set and metric exists)
Also i am wondering why the error page shows database queries? is that normal i mean it shows a bunch of information cant that be used for malicious purposes?
const options = {
method: 'PUT',
headers: {Authorization: 'REDACTED'},
};
fetch("https://status.neiki.dev/api/metrics/4/points/1", options)
.then(response => response.text())
.then(response => console.log(response))
.catch(err => console.error(err));
It's not possible to update a metric point, we don't actually have an update method - https://github.com/cachethq/core/blob/main/src/Http/Controllers/Api/MetricPointController.php
@romalytvynenko it looks like Scramble isn't respecting the use of Laravel's apiResource method https://github.com/cachethq/core/blob/117787672da2cc91ad6d465ce35f41b4d2dc4062/routes/api.php#L25-L39
Marking as a task, as we need to fix the documentation - there is no bug in Cachet itself.
Hey, thanks for the fast response i really appreciate it. I looked at the docs here https://docs.cachethq.io/api-reference/metricpoint/put-metrics-points#put-metrics-points
Because on my site i created a metric graph but it wasnt showing on the statuspage so i thought i needed to use the api to update or create the metrics points first to make the graph visiable, suddenly i used this api path and got a big html error page which also showed a bunch of sql commands.
So i was curious first if that is normal and second what i did wrong.
Thanks tho for the clarification! <3
Can you maybe point me to the direct api documentation to update the metric graph with points to make it visiable on my cachet status page and also to monitor my api latency, because now i am kinda confused how the metrics works and how to update them
Have you set APP_DEBUG=false in your .env file? This should prevent any errors from showing debug information.
In terms of documentation, I'm unsure why Scramble is documenting endpoints which don't exist. @romalytvynenko is the creator of Scramble and will know what to do here.
Thank you very much, but i am confused because in the v3 demo i can see a metrics graph so there must be a way to create it and update it via api or smth? many thanks for the help!
@jbrooksuk @NeikiDev looking into it!
@NeikiDev you need to create points on the metric itself and make sure you have "Display Graphs" checked under "Manage Cachet".
@jbrooksuk Hey thanks, but if i turn on "Display Graphs" in my dashboard under "Manage cachet" and save i reload the page it is disabled again and now metric graph is shown.
I update the settings:
I reload the page:
And is this the right API path to update the metric points?
https://docs.cachethq.io/api-reference/metric-points/create-metric-point#create-metric-point
I just fixed a bug that was causing the setting to do nothing - graphs were always shown anyway.
That said, make sure the Metric itself is visible for users / guests and the option to display it is checked:
That endpoint is correct for adding new points.
@jbrooksuk Hey, yep this are my metrics settings
But no graph or metric visiable on my status page (https://status.neiki.dev/)
I already used the api to even update points and it worked but the graph is not displayed.
I also did like before i opened this issue a update to cachet via composer update cachethq/core
Any idea?
Speaking of API documentation, I fixed the issue with Scramble documenting update endpoint: https://github.com/cachethq/core/pull/258
By the way, MetricPointController@update method is registered here hence it was added to API documentation:
https://github.com/cachethq/core/blob/117787672da2cc91ad6d465ce35f41b4d2dc4062/routes/api.php#L61-L63 You can see it by running route:list command.
Any updates on this? i am still confused how to use the metrics properly
@NeikiDev to confirm;
- You have created a Metric and it's visibility is not set to "Always Hidden".
- The "Display Chart" option is also enabled on the Metric.
- The metric has points.
@jbrooksuk
This is my setup, the metric graph is not shown on the status page.
And idk how to add or manage the points of the metric that was one of my initla questions because the API was buggy