Page MenuHomePhabricator

[Unique Devices] Unique devices returns 200 with an invalid route
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Make a request with an invalid route endpoint using the local unique devices endpoint

Prod :

import requests


prod_url = 'https://wikimedia.org/api/rest_v1/metrics/unique-devices//en.wikipedia.org/all-sites/daily/20200220/20200225'

header = {"accept": "application/json",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"}

response = requests.get(prod_url, headers=header)

print(response.status_code)
print(response.json())

Local:

import requests


base_url = "http://localhost:8089/metrics/unique-devices//en.wikipedia.org/all-sites/daily/20200220/20200225"

header = {"accept": "application/json",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"}

response = requests.get(base_url, headers=header)

print(response.status_code)

print(response.json())

What happens?:

  • In Prod this returns a 404 with and error json
{'type': 'https://mediawiki.org/wiki/HyperSwitch/errors/not_found#route', 'title': 'Not found.', 'method': 'get', 'uri': '/wikimedia.org/v1/metrics/unique-devices//en.wikipedia.org/all-sites/daily/20200220/20200225'}
  • In local it returns a 200 with proper data ( This should not be the case)

What should have happened instead?:

  • returns a 404 with and error json ( Similar to production )

Software version (skip for WMF-hosted wikis like Wikipedia):
N/A

Other information (browser name/version, screenshots, etc.):
N/A

Event Timeline

I added the test to this but realised a few of the existing tests already failed(I'd like to know if I'm the only one experiencing this, maybe it's just something with my local environment)
In regards to this ticket, this is resolved but we may want to look into the other tests and maybe create separate tickets for them.

@codebug I ran the tests on the main branch and they worked fine , can you please update the data on aqs-docker-test and re-run them?
Also , as discussed I found a particular test failing on your branch , could you please investigate the same . Let me know in case of issues . Thanks!

@codebug @SGupta-WMF the above scenario is still failing. I updated the unique services repo before testing but there were no files changes.

or am I missing something ?

I am moving this to paused as I will be assisting Emeka later today with gerrit so he can have the latest on this repo since we have fully moved to gerrit now.
His initial test was done on the gitlab repo which we don't use anymore

codebug changed the task status from Open to Stalled.Feb 27 2023, 8:33 AM
codebug moved this task from In Progress to Blocked/Paused on the API Platform (Sprint 05) board.

Test Status: **QA PASS**

Invalid route:
The above returns the right status code response of 404

and json

{'detail': ['Invalid route'], 'method': 'get', 'status': 404, 'title': 'Not Found', 'type': 'about:blank', 'uri': '/metrics/unique-devices/en.wikipedia.org/all-sites/daily/20200220/20200225'}