airbyte-api-python-sdk icon indicating copy to clipboard operation
airbyte-api-python-sdk copied to clipboard

Cannot use list workspaces

Open alfredopalhares opened this issue 1 year ago • 0 comments
trafficstars

Hello,

Thank you so much for providing this toolset to interact with Airbyte, I am building a Pulumi provider so we can automate this via Pulumi. But while writing some test code, I have found that some examples do not work, the case was with List Workspaces, here is an example snippet:

import airbyte
import dateutil.parser
from airbyte.models import operations, shared

source_conn = airbyte.Airbyte(
    server_url="http://127.0.0.1:8000/api/v1",
    security=shared.Security(
        basic_auth=shared.SchemeBasicAuth(
            username="airbyte",
            password="password"
        )
    )
)

request = operations.ListWorkspacesRequest()
result = source_conn.workspaces.list_workspaces(request)
print(result)

This gives the following error:

-> % ./examples/create_source.py
ListWorkspacesRequest(include_deleted=False, limit=20, offset=0, workspace_ids=None)
Traceback (most recent call last):
  File "/path/to/my/repo/pulumi-airbyte/./examples/create_source.py", line 23, in <module>
    result = source_conn.workspaces.list_workspaces(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/repo/venv/lib/python3.11/site-packages/airbyte/workspaces.py", line 176, in list_workspaces
    raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
airbyte.models.errors.sdkerror.SDKError: API error occurred: Status 404
Object not found.

So I did some research and inpection to try and find some error or mishuse on my side. Using wireshark to fetch the request this is what I get:

GET /api/v1/workspaces?includeDeleted=false&limit=20&offset=0 HTTP/1.1
Host: 127.0.0.1:8000
user-agent: speakeasy-sdk/python 0.44.3 2.237.2 1.0.0 airbyte-api
Accept-Encoding: gzip, deflate
Accept: application/json
Connection: keep-alive
Authorization: Basic YWlyYnl0ZTpwYXNzd29yZA==

HTTP/1.1 404 Not Found
Server: nginx/1.25.3
Date: Thu, 01 Feb 2024 13:15:56 GMT
Content-Type: application/json
Content-Length: 17
Connection: keep-alive

Object not found.

I have replicated the request with insomnia and indeed I get the same response. Looking at your OpenAPI Docs The only request that exists is a POST /v1/workspaces/list and inspecting the source it looks like that is not the case.

Version information:

  • Airbyte Version: 0.50.45
  • Airbyte SDK Version: 0.44.3

I noticed that you are using https://speakeasyapi.dev for the code generation, maybe needs to be re run against the API? Or am I using it wrong ?

Regards, Alfredo Palhares

alfredopalhares avatar Feb 01 '24 14:02 alfredopalhares