threefoldtech / js-sdk

extensions to js-ng for tfgrid
Apache License 2.0
14 stars 6 forks source link

Workloads Query Gives 404 #2314

Closed scottyeager closed 3 years ago

scottyeager commented 3 years ago

When trying to deploy solutions on my up to date 3Bot installed locally with poetry, I see the following error:

  File "/home/scott/builds/js-sdk/jumpscale/sals/chatflows/chatflows.py", line 147, in wrapper
    getattr(self, step_name)()
  File "/home/scott/builds/js-sdk/jumpscale/sals/chatflows/chatflows.py", line 668, in wrapper
    return func(*args, **kwargs)
  File "/home/scott/builds/js-sdk/jumpscale/packages/tfgrid_solutions/chats/ubuntu.py", line 42, in ubuntu_name
    self._ubuntu_start()
  File "/home/scott/builds/js-sdk/jumpscale/packages/tfgrid_solutions/chats/ubuntu.py", line 33, in _ubuntu_start
    deployer.chatflow_network_check(self)
  File "/home/scott/builds/js-sdk/jumpscale/sals/reservation_chatflow/deployer.py", line 1904, in chatflow_network_check
    networks = self.list_networks()
  File "/home/scott/builds/js-sdk/jumpscale/sals/reservation_chatflow/deployer.py", line 354, in list_networks
    self.load_user_workloads(next_action=next_action)
  File "/home/scott/builds/js-sdk/jumpscale/sals/reservation_chatflow/deployer.py", line 325, in load_user_workloads
    all_workloads = j.sals.zos.get().workloads.list(j.core.identity.me.tid, next_action)
  File "/home/scott/builds/js-sdk/jumpscale/sals/zos/workloads.py", line 60, in list
    return self._workloads.list(customer_tid, next_action)
  File "/home/scott/builds/js-sdk/jumpscale/clients/explorer/workloads.py", line 130, in list
    workloads = list(self.iter(customer_tid, next_action))
  File "/home/scott/builds/js-sdk/jumpscale/clients/explorer/workloads.py", line 171, in iter
    yield from filter(filter_next_action, get_all(self._session, Decoder, url, query))
  File "/home/scott/builds/js-sdk/jumpscale/clients/explorer/pagination.py", line 15, in get_all
    iter, pages = get_page(session, 1, model, url, query, auth, headers)
  File "/home/scott/builds/js-sdk/jumpscale/clients/explorer/pagination.py", line 5, in get_page
    resp = session.get(url, params=query, auth=auth, headers=headers)
  File "/home/scott/.cache/pypoetry/virtualenvs/js-sdk-lylQKMy_-py3.8/lib/python3.8/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/home/scott/.cache/pypoetry/virtualenvs/js-sdk-lylQKMy_-py3.8/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/scott/.cache/pypoetry/virtualenvs/js-sdk-lylQKMy_-py3.8/lib/python3.8/site-packages/requests/sessions.py", line 662, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/home/scott/.cache/pypoetry/virtualenvs/js-sdk-lylQKMy_-py3.8/lib/python3.8/site-packages/requests/hooks.py", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/home/scott/builds/js-sdk/jumpscale/clients/explorer/errors.py", line 23, in raise_for_status
    raise HTTPError(http_error_msg, response=resp)
requests.exceptions.HTTPError: 404 Client Error: 404 page not found
 for url: https://explorer.grid.tf/explorer/reservations/workloads?customer_tid=196&next_action=3&page=1
xmonader commented 3 years ago

I think the API endpoint that got called is wrong, possible the explorer url in your configured identity is https://explorer.grid.tf/explorer not https://explorer.grid.tf/api/v1 you can check by

JS-NG> j.core.identity.me.explorer.url                                                                                                                                            
'https://explorer.grid.tf/api/v1'

JS-NG> j.core.identity.me.explorer_url                                                                                                                                            
'https://explorer.grid.tf/api/v1'

https://explorer.grid.tf/api/v1/reservations/workloads?customer_tid=196&next_action=3&page=1 returns empty list on the right explorer api url while https://explorer.grid.tf/explorer/reservations/workloads?customer_tid=196&next_action=3&page=1 returns 404

I guess maybe you followed the identity.md file https://github.com/threefoldtech/js-sdk/blob/development/docs/wiki/identity.md is the reason you ended up with misconfigured identtiy, as the the tfexplorer didn't drop the old api for compatibility and we didn't update the doc to use it yet

scottyeager commented 3 years ago

That was it, thanks!

I'm not sure where I found the info on configuring identity, but it's likely that was the spot. Now I'm understanding the "legacy" markings when I go to visit that explorer API interface in my browser :)