Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template issue when trying to open an Incident #3048

Closed
WastlBastl opened this issue May 17, 2018 · 16 comments
Closed

Template issue when trying to open an Incident #3048

WastlBastl opened this issue May 17, 2018 · 16 comments
Labels
Bug Bugs with Cachet
Milestone

Comments

@WastlBastl
Copy link

Hi,

I have a Problem with the Templates.
When I open a new Inicident via the API and I will use a Template with spaces in the name, the API gave me an error back:

{"errors":[{"id":"6c316469-4986-4707-b0c5-9ba98a826c3d","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The format from message is ung\u00fcltig."]}}]}

But when I change the name to a name without spaces, it works.

I have tried several commands i.e. curl, Powershell Invoke-RestMethod, but the same message appears.

Could you help me with the Problem?

I´m using Version 2.3.14.

It would be nice to have the opportunity to use a template when you close or update an Incident.

@welcome
Copy link

welcome bot commented May 17, 2018

👋 Thank you for opening your first issue. I'm just an automated bot that's here to help you get the information you need quicker, so please ignore this message if it doesn't apply to your issue.
If you're looking for support, you should try the Slack group by registering your email address at https://cachethq-slack.herokuapp.com. Alternatively, email support@alt-three.com for our Professional support service (please note, this a paid service.
If you're issue is with documentation, you can suggest edits by clicking the Suggest Edits link on any page, or open an issue at https://github.com/CachetHQ/Docs

@jbrooksuk
Copy link
Member

Can you share your log file after replicating this bug please.

@no-response
Copy link

no-response bot commented Jun 19, 2018

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@WastlBastl
Copy link
Author

Sorry for the late response.
Here is the log after replecating the Bug.
I hope it is the right log.
If its not the right log, please tell me where I can find it.

test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:22 +0200] "GET /dashboard HTTP/1.1" 302 1425 "http://www.test-cachet.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:22 +0200] "GET /auth/login HTTP/1.1" 200 2118 "http://www.test-cachet.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:22 +0200] "GET /img/cachet-logo@2x.png HTTP/1.1" 200 5022 "http://www.test-cachet.de/auth/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:22 +0200] "GET /dist/css/dashboard/dashboard.css HTTP/1.1" 200 123930 "http://www.test-cachet.de/auth/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:24 +0200] "POST /auth/login HTTP/1.1" 302 1464 "http://www.test-cachet.de/auth/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:25 +0200] "GET /dashboard HTTP/1.1" 200 3777 "http://www.test-cachet.de/auth/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:26 +0200] "GET /api/v1/version HTTP/1.1" 200 339 "http://www.test-cachet.de/dashboard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:19:59:28 +0200] "GET /dashboard/templates HTTP/1.1" 200 2852 "http://www.test-cachet.de/dashboard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:20:00:22 +0200] "GET /dashboard/user HTTP/1.1" 200 3207 "http://www.test-cachet.de/dashboard/templates" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:20:00:40 +0200] "POST /api/v1/incidents HTTP/1.1" 400 448 "-" "Mozilla/5.0 (Windows NT; Windows NT 10.0; de-DE) WindowsPowerShell/5.1.17134.112"
test-cachet.de:80 192.168.40.209 - - [19/Jun/2018:20:00:40 +0200] "GET /api/v1/incidents HTTP/1.1" 200 13447 "-" "Mozilla/5.0 (Windows NT; Windows NT 10.0; de-DE) WindowsPowerShell/5.1.17134.112"

@jbrooksuk
Copy link
Member

Sorry @Unbr8kable that’s not the right log. You can find it in ./storage/logs/Laravel.logit may have a time stamp on.

@WastlBastl
Copy link
Author

Oh sry.
Thank you for the fast reply. I have found the log.

production.ERROR: AltThree\Validator\ValidationException: Validation has failed. in /var/www/html/Cachet/vendor/alt-three/validator/src/ValidatingObserver.php:89
Validation errors:
The format of message is invalid.
Stack trace:
#0 /var/www/html/Cachet/vendor/alt-three/validator/src/ValidatingObserver.php(54): AltThree\Validator\ValidatingObserver->validate(Object(CachetHQ\Cachet\Models\Incident))
#1 [internal function]: AltThree\Validator\ValidatingObserver->saving(Object(CachetHQ\Cachet\Models\Incident))
#2 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(367): call_user_func_array(Array, Array)
#3 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): Illuminate\Events\Dispatcher->Illuminate\Events{closure}('eloquent.saving...', Array)
#4 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(159): Illuminate\Events\Dispatcher->dispatch('eloquent.saving...', Array, true)
#5 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php(148): Illuminate\Events\Dispatcher->until('eloquent.saving...', Object(CachetHQ\Cachet\Models\Incident))
#6 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(506): Illuminate\Database\Eloquent\Model->fireModelEvent('saving')
#7 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(734): Illuminate\Database\Eloquent\Model->save()
#8 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Support/helpers.php(964): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent{closure}(Object(CachetHQ\Cachet\Models\Incident))
#9 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(735): tap(Object(CachetHQ\Cachet\Models\Incident), Object(Closure))
#10 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1374): Illuminate\Database\Eloquent\Builder->create(Array)
#11 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1386): Illuminate\Database\Eloquent\Model->__call('create', Array)
#12 /var/www/html/Cachet/app/Bus/Handlers/Commands/Incident/CreateIncidentCommandHandler.php(103): Illuminate\Database\Eloquent\Model::__callStatic('create', Array)
#13 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(90): CachetHQ\Cachet\Bus\Handlers\Commands\Incident\CreateIncidentCommandHandler->handle(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#14 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#15 /var/www/html/Cachet/vendor/alt-three/validator/src/ValidatingMiddleware.php(61): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#16 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): AltThree\Validator\ValidatingMiddleware->handle(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand), Object(Closure))
#17 /var/www/html/Cachet/app/Bus/Middleware/UseDatabaseTransactions.php(35): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#18 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(29): CachetHQ\Cachet\Bus\Middleware\UseDatabaseTransactions->CachetHQ\Cachet\Bus\Middleware{closure}(Object(Illuminate\Database\MySqlConnection))
#19 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(327): Illuminate\Database\Connection->transaction(Object(Closure))
#20 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): Illuminate\Database\DatabaseManager->__call('transaction', Array)
#21 /var/www/html/Cachet/app/Bus/Middleware/UseDatabaseTransactions.php(36): Illuminate\Support\Facades\Facade::__callStatic('transaction', Array)
#22 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): CachetHQ\Cachet\Bus\Middleware\UseDatabaseTransactions->handle(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand), Object(Closure))
#23 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#24 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#25 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(75): Illuminate\Bus\Dispatcher->dispatchNow(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#26 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(378): Illuminate\Bus\Dispatcher->dispatch(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#27 /var/www/html/Cachet/app/Http/Controllers/Api/IncidentController.php(82): dispatch(Object(CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand))
#28 [internal function]: CachetHQ\Cachet\Http\Controllers\Api\IncidentController->store()
#29 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): call_user_func_array(Array, Array)
#30 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): Illuminate\Routing\Controller->callAction('store', Array)
#31 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(CachetHQ\Cachet\Http\Controllers\Api\IncidentController), 'store')
#32 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\Routing\Route->runController()
#33 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Routing/Router.php(572): Illuminate\Routing\Route->run()
#34 /var/www/html/Cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))

@jbrooksuk
Copy link
Member

Oh... this was fixed in v2.4 are you sure you’re on v2.3? If so, I’ll port the fix.

@WastlBastl
Copy link
Author

Yes i am sure.
I´m using Version 2.3.14.

Is v2.4 currently released?

@jbrooksuk
Copy link
Member

v2.4 (which will become v3.0, see #2943) is currently in development.

Can you share the request you're making?

@jbrooksuk jbrooksuk added this to the V2.3.14 milestone Jun 21, 2018
@WastlBastl
Copy link
Author

What do you mean with „share the request“?
Where should I share it?
Sry I am new in github.

@nalysius
Copy link
Contributor

@Unbr8kable you sent an HTTP request to the API. We'd need this exact request to reproduce it on our own machines. The request includes the URL, headers, and body. You should just remove your real API key, of course.
It may be the curl command line with all the options, of even a Postman export. In short, we need to reproduce the problem.

@WastlBastl
Copy link
Author

Hi,
thats the request i sent to the API with curl.

curl -H "Content-Type: application/json;" -H "X-Cachet-Token: abcdef" --data '{"name":"Downtime","status":2,"visible":1,"component_id":1,"component_status":2,"template":"That is a Template"}' www.ghijklmn.de/api/v1/incidents

@nalysius
Copy link
Contributor

@Unbr8kable I've not tested your request yet, but I've read a documentation I was writing, and the message parameter seems to be missing.

@WastlBastl
Copy link
Author

Thats right, the message parameter is missing, we some templates for different incidents.
So we use an automation to post our incidents on our status page.

When I post an incident with a template without spaces, e.g. thisisatemplate, this error message doesnt appear.
But when I post an incident with a template with space, e.g. This is a template, this error message appears.

@nalysius
Copy link
Contributor

Ok I've just tested your request.
I am on PHP 7.2.5 with Cachet 2.4~dev, and when I send the following request

curl -H "Content-Type: application/json;" -H "X-Cachet-Token: kHgFghvC42H" \
    --data \
'{"name":"Downtime","status":2,"visible":1,"component_id":1,"component_status":2,"template":"ThatisaTemplate"}' \
    http://cachet.local/api/v1/incidents

I have this error

{"errors":[{"id":"5230d04c-a524-48cc-af7e-84d50ebde465","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The message field is required."]}}]}

Please note that the "template" field is supposed to be a template slug. So, it's not supposed to contains spaces.
For me it seems to work. If you have a reproducing example, I can test too.

@jbrooksuk
Copy link
Member

Thanks @anthonybocci, I'm going to close this issue, but if you need further help @Unbr8kable we can re-ope it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bugs with Cachet
Projects
None yet
Development

No branches or pull requests

3 participants