-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Sorting by non-existing field returns http error 500 #8072
Comments
Thanks for opening this issue!
|
So the dashboard is trying to sort by a field that doesn't exist, right? It's expected that Parse Server returns an error, but it should be a 4xx, not 5xx. Parse Dashboard also cannot know whether a field still exists before making the query, unless it fetched the schema before each query. So it can either fetch the schema which may be an overhead we don't want, or it should display a proper error that one of the fields doesn't exist. For that, Parse Server needs to returns a proper error code, presumably http 400 and the corresponding Parse.Error code. |
Yes, to be honest, not sure if this issue is even a parse-server thing... Quickly thinking a solution should be adding some "check" in parse-dashboard, something like removing the "order" flag in the class before deleting the field in case the class is being sorted by the target field. I am assuming that the order is stored in the class somewhere and that the order/sort can only be applied on parse-dasboard, not thru the SDKs. |
sounds good, but this is a Parse Dashboard issue that needs to be opened separately
This is a feature request to manually remove the sort; unrelated to the logic suggested above.
As discussed, Parse Server should not throw 5xx, but 4xx when sorting by a non-existing field. This is the only issue that needs to be addressed on the Parse Server side, and this issue here should only focus on that. Anything else that concerns Parse Dashboard or SDK side are separate issues that need to be opened in the respective repos.
There is no server side order; order is a parameter of a query. If a developer deletes a field and then sends a query using an SDK, it is the developer's responsibility to account for the deletion of that field by adapting the query; or properly handle the 4xx server response in case the field doesn't exist anymore. |
This is the Parse Server issue, so let's focus on the Parse Server side here and forget about the dashboard for now. The 500 http error comes from the server. Parse Server should never return a 500 error; it means that something wasn't handled properly inside Parse Server. The usual approach would be to create a PR with a failing test. Just write a minimal code example and try to reproduce what you observe, so that the test fails with a 500 code. As I understand, the test would be to create a query and order by a non-existing field. The test should expect a 4xx error with the correct Anything else that is Parse Dashboard related should be discussed in a separate issue in that repo. |
@MrMartinR I have tried to replicate this but have been able. I am on the latest dashboard and parse server. I've tried to manually add the invalid fetch('PARSE_URL/classes/_User', {
body: JSON.stringify({
order: 's',
where: {},
_ApplicationId: APP_ID,
_ClientVersion: 'js3.4.2',
_MasterKey: MASTER_KEY,
_method: 'GET',
}),
method: 'POST',
})
.then(res => res.json())
.then(obj => console.log(obj));
|
@dblythy are you getting the error500? |
No I wasn't, I'm getting results |
I'm using Dashboard 4.2.0-ALPHA.4 and Server 3.4.3, if the column |
Ahh, in my testing I was using mongo. I’ll try again with Postgres tomorrow |
🎉 This change has been released in version 5.3.0-alpha.26 |
🎉 This change has been released in version 5.4.0-beta.1 |
🎉 This change has been released in version 5.4.0-alpha.1 |
🎉 This change has been released in version 5.4.0 |
🎉 This change has been released in version 5.4.0 |
New Issue Checklist
Issue Description
If I delete a field that was previously sorted/ordered in Parse Dashboard, when I try to load the records from that class, returns a 500 error.
Steps to reproduce
I created a column (named ‘s’) in the Contact class to test the schema, then I deleted it via Dashboard and via JS SDK but when I click on the dashboard Contact Class, no records are showing, and parse server log complains with error:
If I create the field again (via dashboard or via JS) the error goes away and the records appear
I found the cause in the POST request when I select the Contact Class that returns a 500 error
Actual Outcome
Error 500
Expected Outcome
Not get the error and load the records
Environment
Local environment
Server
5.3.2
macOS Monterrey
Local
Database
Postgres
14.3
Local
(I did not tried in remote)Client
JavaScript
3.4.2
Logs
The text was updated successfully, but these errors were encountered: