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

Validation errors are being mishandled by JsonApiExceptionHandler #164

Open
geoidesic opened this issue Jan 1, 2022 · 0 comments
Open

Comments

@geoidesic
Copy link
Collaborator

This results in a. CORS error message instead of the expected validation error messages:

Here's the stack trace:

2022-01-01 19:40:07 Error: [Crud\Error\Exception\ValidationException] 6 validation errors occurred in /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Listener/ApiListener.php on line 156
Stack Trace:
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Listener/ApiListener.php:100
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Event/EventManager.php:309
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Event/EventManager.php:286
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Controller/Component/CrudComponent.php:550
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Core/ProxyTrait.php:51
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Action/EditAction.php:189
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Action/EditAction.php:131
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Action/EditAction.php:157
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Action/BaseAction.php:62
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Controller/Component/CrudComponent.php:244
- /Users/noeldacosta/repo/github/mnr-be/src/Controller/Baked/PeopleController.php:100
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Controller/Controller.php:531
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud/src/Controller/ControllerTrait.php:75
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php:151
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/BaseApplication.php:313
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:77
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:77
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php:174
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:73
- /Users/noeldacosta/repo/github/mnr-be/plugins/Cors/src/Middleware/CorsMiddleware.php:31
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:73
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:58
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php:167
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:73
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php:68
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:73
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php:126
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:73
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:58
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Server.php:90
- /Users/noeldacosta/repo/github/mnr-be/webroot/index.php:40

Request URL: /api/people/3c9b642a-6682-4b7a-aff2-000000000020
Referer URL: http://localhost:8080/


2022-01-01 19:40:07 Error: [TypeError] Argument 3 passed to Neomerx\JsonApi\Schema\ErrorCollection::addDataAttributeError() must be of the type string or null, array given, called in /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud-json-api/src/Error/JsonApiExceptionRenderer.php on line 160 in /Users/noeldacosta/repo/github/mnr-be/vendor/neomerx/json-api/src/Schema/ErrorCollection.php on line 305
Stack Trace:
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud-json-api/src/Error/JsonApiExceptionRenderer.php:160
- /Users/noeldacosta/repo/github/mnr-be/vendor/friendsofcake/crud-json-api/src/Error/JsonApiExceptionRenderer.php:106
- /Users/noeldacosta/repo/github/mnr-be/src/Error/AppExceptionRenderer.php:35
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php:293
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php:228
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php:148
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php:130
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:73
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Runner.php:58
- /Users/noeldacosta/repo/github/mnr-be/vendor/cakephp/cakephp/src/Http/Server.php:90
- /Users/noeldacosta/repo/github/mnr-be/webroot/index.php:40

Request URL: /api/people/3c9b642a-6682-4b7a-aff2-000000000020
Referer URL: http://localhost:8080/

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

No branches or pull requests

1 participant