LayoutApi list api unhandled page parameter and fails with internal server error 500
prathapbelli opened this issue · comments
In
LayoutApi list api page taken as int not handled with if condition as 0 makes false and page query parameter remain unset.
if page:
payload["page"] = page
if limit:
payload["pageSize"] = limit
Even if we bypass this by directly calling handle request method we will get internal server error 500 statuscode
payload = {"page": 0, "pageSize": 100}
layout_client.handle_request("GET", layout_client._layout_url, payload=payload)
if we request the same with bearer token available in our novo platform api call we are getting successful results
response = requests.get(url=f"{layout_client._layout_url}?page=0&pageSize=100", headers={"Authorization": f"Bearer {token}"})
Hello, it doesn't seem to be a link with the SDK because the page is optional.
This means we don't need to specify "page": 0 should be the default (or 1 if the page starts at 1).
Any way, if we not pass optional params also we are getting requests.exceptions.HTTPError: 500 Server Error: Internal Server Error
here's the code
layout_client = LayoutApi(url=novu_url, api_key=novu_api_key)
response = layout_client.list()
api key and url are correct , its working fine for other apis.
here you see layout api on novu platform, page starts with 0
Sorry for the delay, the holidays....
I'm submitting a hotfix to unblock the situation, but it's a problem at the level of the API itself and not of the SDK in my opinion because the proposed contract is not respected.
@ryshu As I mentioned above even we bypass/handled page parameter, list api was failing with ApiKey Authorization but it works against bearer token.
@ryshu As I mentioned above even we bypass/handled page parameter, list api was failing with ApiKey Authorization but it works against bearer token.
What you're talking about here is not an issue with the SDK, but with the Novu API directly.
You're implying here that the API doesn't accept Token APIs on one of its routes, so there's a problem that Novu maintainers need to fix.
I close the issue here given that the patch was passed on the latest version, you will have to open an issue here if you want the Bearer problem to be addressed: https://github.com/novuhq/novu/issues/new?assignees=&labels=type%3A+bug&projects=&template=bug_report.yml&title=%F0%9F%90%9B+Bug+Report%3A+
Hi @unicodeveloper,
You can close this issue, the problem raised here is a problem in the Novu API and not the SDK
@prathapbelli can you raise the issue on the main Novu repo and reference this issue?