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

Mishandling of total_count value in instance API make the instance API unusable #555

Closed
havetc opened this issue Jun 15, 2024 · 1 comment · Fixed by #595
Closed

Mishandling of total_count value in instance API make the instance API unusable #555

havetc opened this issue Jun 15, 2024 · 1 comment · Fixed by #595
Assignees
Labels
bug Something isn't working instance Instance issues, bugs and feature requests priority:highest Bugs filled by customers, security issues

Comments

@havetc
Copy link

havetc commented Jun 15, 2024

On python 3.12, version 2.3.1 of the scaleway package

There seems to be a lot of instance api functions having issues with the total_count value "returned", I checked for at least theses but there is probably more:

  • list_servers_types
  • list_servers
  • list_servers_all
  • get_server_types_availability

Checking the scaleway-go-sdk, it seems that for the instance API it is checking the "X-Total-Count"
https://github.com/scaleway/scaleway-sdk-go/blob/a057dbf8e7a1d8fabcfbdc7ba09416568a15fc61/scw/client.go#L255

In the function, after the http request is made I printed res.headers just before res.json() is sent to the Marshalling, and I just saw that indeed a "x-total-count" headers is present with the correct value (at least for get_server_types_availability which I tested).

Could you fix the handling of this value for the whole instance API? As function calls crashes otherwise, it seems like a serious issue.

Could it also be made clear in the Readme that this package is supposed to be an alpha and is not production-ready ?

@Laure-di Laure-di self-assigned this Jun 17, 2024
@Laure-di Laure-di added the bug Something isn't working label Jun 17, 2024
@Codelax Codelax added priority:highest Bugs filled by customers, security issues instance Instance issues, bugs and feature requests labels Jul 1, 2024
@gg3nx
Copy link

gg3nx commented Jul 1, 2024

I can confirm issue for get_server_types_availability on 2.4.1:

File "/app/.venv/lib/python3.11/site-packages/scaleway/instance/v1/api.py", line 286, in get_server_types_availability
     return unmarshal_GetServerTypesAvailabilityResponse(res.json())
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.venv/lib/python3.11/site-packages/scaleway/instance/v1/marshalling.py", line 1785, in unmarshal_GetServerTypesAvailabilityResponse
     return GetServerTypesAvailabilityResponse(**args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 TypeError: GetServerTypesAvailabilityResponse.__init__() missing 1 required positional argument: 'total_count'

This is probably a duplicate of #550.

Maybe some tests could detect these issues during development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working instance Instance issues, bugs and feature requests priority:highest Bugs filled by customers, security issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants