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

Fatal error: In Feedback.sendFeedbackForFeature API #18537

Closed
tsteur opened this issue Dec 23, 2021 · 5 comments · Fixed by #18547
Closed

Fatal error: In Feedback.sendFeedbackForFeature API #18537

tsteur opened this issue Dec 23, 2021 · 5 comments · Fixed by #18547
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Dec 23, 2021

Getting below error.

Error: {"message":"Argument 2 passed to Piwik\Plugins\Feedback\API::sendFeedbackForFeature() must be of the type int, string given","file":"plugins/Feedback/API.php","line":38," "request_id":"d5fc2","backtrace":" on /plugins/Feedback/API.php(38)\n#0 [internal function]: Piwik\Plugins\Feedback\API->sendFeedbackForFeature('Help', 'index.php/.', 'dislikeother', 'e')\

I noticed this API is enforcing specific types. I'm thinking in API's we should likely not make use of PHP types like (?string $featureName, int $like as it could cause issues like fatal errors when you actually want a regular error message response that the input is not correct.

Could we maybe remove those types there and in general document to not use any types there? We could maybe even have an automated test that checks that no API has specific parameters enforced.

It can be frustrating otherwise when consuming the API and all you get is an HTTP 500 and you don't know what you're doing wrong. Also we get emailed about it every time this happens which can be annoying too.

@tsteur tsteur added Bug For errors / faults / flaws / inconsistencies etc. Regression Indicates a feature used to work in a certain way but it no longer does even though it should. labels Dec 23, 2021
@tsteur tsteur added this to the 4.7.0 milestone Dec 23, 2021
@peterhashair peterhashair self-assigned this Dec 28, 2021
@justinvelluppillai
Copy link
Contributor

@peterhashair it'd be good to check if you can add or update any documentation to reflect @tsteur's suggestion of not typing API endpoints so this is clear in future as part of this task.

@justinvelluppillai justinvelluppillai added the c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. label Jan 6, 2022
@peterhashair
Copy link
Contributor

@justinvelluppillai
Copy link
Contributor

I mean adding a note to not use typed parameters, perhaps on this page https://developer.matomo.org/guides/apis

@peterhashair
Copy link
Contributor

@justinvelluppillai right, ah how do I access that API site :)

@justinvelluppillai
Copy link
Contributor

There's an Edit on Github link at the bottom of the page

@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants