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

Cannot initialize IBMServerlessClient inside serverless program #1544

Open
frankharkins opened this issue Nov 26, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@frankharkins
Copy link
Member

Steps to reproduce the problem

  1. Run this code in a serverless program.

    from qiskit_serverless import IBMServerlessClient
    serverless = IBMServerlessClient(token="<YOUR_IBM_QUANTUM_TOKEN>")

What is the current behavior?

The job errors. Here are the logs (with my token redacted):

2024-11-26 16:29:22,326	INFO job_manager.py:531 -- Runtime env is setting up.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/qiskit_serverless/core/clients/serverless_client.py", line 134, in _verify_token
    safe_json_request(
  File "/usr/local/lib/python3.11/site-packages/qiskit_serverless/utils/json.py", line 143, in safe_json_request
    raise QiskitServerlessException(error_message)
qiskit_serverless.exception.QiskitServerlessException: 
| Message: Connection error. Make sure configuration (host and auth details) is correct.
| Code: AUTH1001

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/ray/session_2024-11-26_16-29-10_902153_1/runtime_resources/working_dir_files/_ray_pkg_80432732e942e5df/my_program.py", line 2, in <module>
    serverless = IBMServerlessClient(token="***")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/qiskit_serverless/core/clients/serverless_client.py", line 472, in __init__
    super().__init__(token=token, host=IBM_SERVERLESS_HOST_URL)
  File "/usr/local/lib/python3.11/site-packages/qiskit_serverless/core/clients/serverless_client.py", line 123, in __init__
    self._verify_token(token)
  File "/usr/local/lib/python3.11/site-packages/qiskit_serverless/core/clients/serverless_client.py", line 143, in _verify_token
    raise QiskitServerlessException("Cannot verify token.") from reason
qiskit_serverless.exception.QiskitServerlessException: Cannot verify token.

I get the same problem if I provide no arguments.

What is the expected behavior?

IBMServerlessClient class initializes correctly.

@frankharkins frankharkins added the bug Something isn't working label Nov 26, 2024
github-merge-queue bot pushed a commit to Qiskit/documentation that referenced this issue Nov 26, 2024
Fixes #2325 and adds some tests.

I couldn't get the file download functionality working. I believe it's
actually impossible at the moment so I'm removing it from the docs. When
Qiskit/qiskit-serverless#1544 is closed, we
can add it back in.
@Tansito
Copy link
Member

Tansito commented Dec 10, 2024

Thanks to open this @frankharkins , we will take a look. Initially this is working because we are using it in our tests I think but let me confirm in case I was confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants