Troubleshooting
What to do when a request can't connect, times out, or takes long.
On this page
Why can't my request connect?
curl says Failed to connect to api.perfectvector.com port 443 or Couldn't connect to server
(exit code 7 or 28). Other clients say "connection timed out" or "connection refused".
Your request never reached PerfectVector, so nothing was converted or charged. Retry it. The cause is usually the network between you and the internet: Wi-Fi or a VPN reconnecting, a proxy, or a firewall.
If it keeps happening:
-
Check that your network reaches the API. This call is free:
Example requestcurl -sS https://api.perfectvector.com/v1/account \ -H "Authorization: Bearer $PERFECTVECTOR_API_KEY" -
Try another network, or turn the VPN or proxy off.
-
Still failing? Contact us with the time it happened and the full error message.
How do I fail fast and retry safely?
Many HTTP clients wait a minute or more before they give up on a connection (curl on macOS: 75 seconds). Set two separate limits:
- a connect timeout of about 10 seconds, so a bad connection fails fast;
- a total timeout above the 120-second wait, such as 150 seconds.
Then retry with the same Idempotency-Key:
curl https://api.perfectvector.com/v1/vectorizations \
--connect-timeout 10 --max-time 150 \
--retry 3 --retry-connrefused \
-H "Authorization: Bearer $PERFECTVECTOR_API_KEY" \
-H "Idempotency-Key: order-1042-logo" \
-F image=@logo.png
--retry 3 tries again after a timeout or a temporary server error, and --retry-connrefused
after a refused connection.
My request timed out after I sent it. Was I charged?
The conversion may have started. Retry with the same Idempotency-Key: you get that conversion
back (201 if it has finished, 202 while it runs), and it is never charged twice. Without the
key, a retry can convert and charge the same image again. See Idempotency.
Why does the answer take up to two minutes?
By default the API waits up to 120 seconds for the result. If the conversion finishes, you get
201; if not, 202 with a Location header. Then call GET /v1/vectorizations/{id} about every
2 seconds. To get an answer at once and poll, send Prefer: respond-async. See
Waiting and async.
The API sent an error code. What now?
The connection works. Look up the code in Errors. The timeout code is not a
client timeout: the conversion did not finish in time, nothing was charged, and you retry with a
new Idempotency-Key.