question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

access token was not provided when running opal-client

See original GitHub issue

I run opal-server and opal-client.

This is the error I got on opal-client

2021-08-02T15:37:52.223415+0800 |opal_client.data.fetcher                | INFO  | [<ClientResponse(http://localhost:7002/policy-data) [401 Unauthorized]>
<CIMultiDictProxy('Date': 'Mon, 02 Aug 2021 07:37:52 GMT', 'Server': 'uvicorn', 'WWW-Authenticate': 'Bearer', 'Content-Length': '65', 'Content-Type': 'application/json')>
]
2021-08-02T15:37:52.223593+0800 |opal_client.data.updater                |ERROR  | Failed to fetch url http://localhost:7002/policy-data, got response code 401 with error: {'detail': {'error': 'access token was not provided', 'token': None}}
2021-08-02T15:37:52.953338+0800 |opal_client.client                      | INFO  | stopping background tasks...

I did some checking on the code and edit it, the error went away.

opal_client/data/fetcher.py

async def handle_urls(self, urls: List[Tuple[str, FetcherConfig]] = None) -> List[Tuple[str, FetcherConfig, Any]]:
        """
        Fetch data for each given url with the (optional) fetching configuration; return the resulting data mapped to each URL

        Args:
            urls (List[Tuple[str, FetcherConfig]], optional): Urls (and fetching configuration) to fetch from.
            Defaults to None - init data_url with HttpFetcherConfig (loaded with the provided auth token).

        Returns:
            List[Tuple[str,FetcherConfig, Any]]: urls mapped to their resulting fetched data
        """

        # tasks
        tasks = []
        # if no url provided - default to the builtin route
        if urls is None:
            urls = [(self._data_url, self._default_fetcher_config)]
        # create a task for each url
        for url, config in urls:
            if not config:
                config = self._default_fetcher_config
            tasks.append(self.handle_url(url, config))

        # wait for all data fetches to complete
        results = await asyncio.gather(*tasks, return_exceptions=True)
        logging.info(results)

Please let me know if this is the intended behavior of the function in order for it to work?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
asafccommented, Aug 2, 2021

Oh i am sorry i did not see you pass the token. Let me take a closer look at your log.

0reactions
asafccommented, Aug 3, 2021

Cool, i am glad you got it working! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

My Profile - OBiBa Opal Documentation
Personal access tokens can be created for use in scripts and on the command line (using R or Python client API). Be careful,...
Read more >
Personal API access token · Issue #3508 · obiba/opal - GitHub
Problem: when authenticating with a token (OpalTokenRealm) the user's roles/groups are not known (because these are provided by the user's ...
Read more >
Running OPAL - Full Guide
Running OPAL - Full Guide. How to run OPAL Server​. This section explains how to run OPAL Server. Step 1: Get the server...
Read more >
Opal Documentation - Read the Docs
Opal is OBiBa's core database application for biobanks. Participant data, once collected either from OBiBa's Onyx.
Read more >
PAT is not working for all opal-python-client commands
while automating our project administration and report runs we stumbled ... and not with the personal access token (PAT) of our Opal admin ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found