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.

Bad Request API resultDownloadUrl: Cannot get presigned download url

See original GitHub issue

Information

  • Qiskit IBMQ Provider version: 0.17.0 (Python)

  • API URL or version: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/<job number>/resultDownloadUrl

  • Python version: 3.6

  • Operating system: Ubuntu Linux

What is the current behavior?

qiskit.providers.ibmq.job.exceptions.IBMQJobApiError: "Unable to retrieve result for job <job number>: '400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/<job number>/resultDownloadUrl. Cannot get presigned download url., Error code: 3202

Steps to reproduce the problem

The issue only occurs when running on a real device (not a simulator). Code has worked fine in the past (prior to version 0.17.0 being released). Running code from here:

IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q')
small_devices = provider.backends(filters=lambda x: x.configuration().n_qubits == 5 and not x.configuration().simulator)
least_busy_device = least_busy(small_devices)
job_sim = execute(self._quantum_game.circ, least_busy_device, shots=n_times)
res_sim = job_sim.result()
counts = res_sim.get_counts(self._quantum_game.circ)

The error occurs after execute() and before .result()

What is the expected behavior?

Circuit to execute fully and results of run become available.

Suggested solutions

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jyu00commented, Apr 6, 2020

This is now fixed. Thanks @desireevl for reporting it!

0reactions
jyu00commented, Apr 6, 2020

This problem is due to erroneous response sent by the server through the websocket connection, which is used by job.result() to wait for the job to finish. As a temporary workaround, you can manually poll for the job status, bypassing websocket:

import time
from qiskit.providers.jobstatus import JOB_FINAL_STATES

while job.status() not in JOB_FINAL_STATES:
    time.sleep(5)
result = job.result()

“Temporary” is highlighted because using job.status() to poll is generally not recommended as it could cause the server to deny your request due to excessive requests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS S3 - 400 Bad Request when PUTting file via pre-signed ...
I have allowed public access and set both CORS (which is why I get the pre-signed URL to upload to in the first...
Read more >
ibm q experience - Error while running Quantum Teleportation ...
The error which the following code gives is: IBMQJobApiError: "'400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/api ...
Read more >
Using presigned URLs - Amazon Simple Storage Service
Use a presigned URL to share or upload objects in Amazon S3 without requiring AWS security credentials or permissions.
Read more >
S3 Uploads — Proxies vs Presigned URLs vs Presigned POSTs
The final request to our API contains the S3 object details instead of the file itself and performs the other actions. Let's take...
Read more >
How to Fix a 400 Bad Request Error (Causes and Fixes) - Kinsta
The 400 Bad Request error indicates that the server cannot or process the request due to a client error. Read about the common...
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