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

sortOrder parameter must be either 'asc' or 'desc'. #126

Closed
GammaGames opened this issue Jun 12, 2020 · 5 comments
Closed

sortOrder parameter must be either 'asc' or 'desc'. #126

GammaGames opened this issue Jun 12, 2020 · 5 comments

Comments

@GammaGames
Copy link

GammaGames commented Jun 12, 2020

VSCodium has changed to openvsx in the latest version, but when I try to search for extensions I get an error.
image

I looked at the request that's being sent, the payload is:

{
  "filters": [
    {
      "criteria": [
        {
          "filterType": 8,
          "value": "Microsoft.VisualStudio.Code"
        },
        {
          "filterType": 10,
          "value": "test"
        },
        {
          "filterType": 12,
          "value": "4096"
        }
      ],
      "pageNumber": 1,
      "pageSize": 50,
      "sortBy": 0,
      "sortOrder": 0
    }
  ],
  "assetTypes": [],
  "flags": 946
}

And the 500 response is:

{
  "timestamp": "2020-06-12T15:33:26.792+0000",
  "status": 500,
  "error": "Internal Server Error",
  "message": "sortOrder parameter must be either 'asc' or 'desc'.",
  "path": "/vscode/gallery/extensionquery"
}

I was referred here from VSCodium/vscodium/issues/418

@aniketbarik
Copy link

I'm facing the same issue.

@GammaGames
Copy link
Author

Oh, looks like sorting is a new feature. Probably related to /pull/123

@ghost
Copy link

ghost commented Jun 13, 2020

Do we know the code that is creating the request payload?

@phd
Copy link

phd commented Jun 13, 2020

This issue seems to be caused by this recent commit: 599b2ec

VSCodium (1.46.0) sends this POST request (curl):

curl 'https://open-vsx.org/vscode/gallery/extensionquery' -H 'authority: open-vsx.org' -H 'x-market-user-id: c0d44d13-c763-4b1b-87bc-ea5f3149b45a' -H 'accept: application/json;api-version=3.0-preview.1' -H 'origin: file://' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) VSCodium/1.46.0 Chrome/78.0.3904.130 Electron/7.3.1 Safari/537.36' -H 'x-market-client-id: VSCode 1.46.0' -H 'content-type: application/json' -H 'sec-fetch-site: cross-site' -H 'sec-fetch-mode: cors' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: pl' --data-binary '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":7,"value":"nathanridley.autotrim"},{"filterType":7,"value":"dbaeumer.vscode-eslint"},{"filterType":7,"value":"esbenp.prettier-vscode"},{"filterType":7,"value":"rust-lang.rust"},{"filterType":7,"value":"matklad.rust-analyzer"},{"filterType":7,"value":"ecmel.vscode-html-css"},{"filterType":7,"value":"firefox-devtools.vscode-firefox-debug"},{"filterType":7,"value":"mythmon.idl"},{"filterType":12,"value":"4096"}],"pageNumber":1,"pageSize":8,"sortBy":0,"sortOrder":0}],"assetTypes":[],"flags":946}'

The response is 500:

{"timestamp":"2020-06-13T18:18:43.268+0000","status":500,"error":"Internal Server Error","message":"sortOrder parameter must be either 'asc' or 'desc'.","path":"/vscode/gallery/extensionquery"}

However when trying to fulfill that requirement ("sortOrder":"asc"):

curl 'https://open-vsx.org/vscode/gallery/extensionquery' -H 'authority: open-vsx.org' -H 'x-market-user-id: c0d44d13-c763-4b1b-87bc-ea5f3149b45a' -H 'accept: application/json;api-version=3.0-preview.1' -H 'origin: file://' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) VSCodium/1.46.0 Chrome/78.0.3904.130 Electron/7.3.1 Safari/537.36' -H 'x-market-client-id: VSCode 1.46.0' -H 'content-type: application/json' -H 'sec-fetch-site: cross-site' -H 'sec-fetch-mode: cors' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: pl' --data-binary '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":7,"value":"nathanridley.autotrim"},{"filterType":7,"value":"dbaeumer.vscode-eslint"},{"filterType":7,"value":"esbenp.prettier-vscode"},{"filterType":7,"value":"rust-lang.rust"},{"filterType":7,"value":"matklad.rust-analyzer"},{"filterType":7,"value":"ecmel.vscode-html-css"},{"filterType":7,"value":"firefox-devtools.vscode-firefox-debug"},{"filterType":7,"value":"mythmon.idl"},{"filterType":12,"value":"4096"}],"pageNumber":1,"pageSize":8,"sortBy":0,"sortOrder":"asc"}],"assetTypes":[],"flags":946}'

you still get an error:

{"timestamp":"2020-06-13T18:19:53.366+0000","status":400,"error":"Bad Request","message":"JSON parse error: Cannot deserialize value of type intfrom String \"asc\": not a valid Integer value; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of typeint from String \"asc\": not a valid Integer value\n at [Source: (PushbackInputStream); line: 1, column: 559] (through reference chain: org.eclipse.openvsx.adapter.ExtensionQueryParam[\"filters\"]->java.util.ArrayList[0]->org.eclipse.openvsx.adapter.ExtensionQueryParam$Filter[\"sortOrder\"])","path":"/vscode/gallery/extensionquery"}

So it seems sortOrder is expected to be an integer value, and the check for 'asc'/'desc' is wrong.

@ghost
Copy link

ghost commented Jun 14, 2020

I'm guessing the integer value is just 0 or 1 so we can open a PR to fix it while keeping the 'asc' and 'desc' checks since that's what eclipse is looking for.

CptTZ added a commit to CptTZ/openvsx that referenced this issue Jun 15, 2020
CptTZ added a commit to CptTZ/openvsx that referenced this issue Jun 15, 2020
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

Successfully merging a pull request may close this issue.

3 participants