You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I’m making a POST request to the "predictions" endpoint with the Prefer: respond-async header and the webhook URL in the body. The webhook is working, and I’m receiving all events without any issues. However, I’m unable to figure out how to access the output path URL from the "succeeded" event via an HTTP server. When I try to access that URL, I get a 404 error with the message {"detail":"Not Found"}.
Hi @yigithanyucedag thanks for reporting this issue. This looks like a bug in the cog webhook implementation which is returning you a path to the file on disk rather than a URL.
Can you share a little more about how you are running the cog server?
There are currently two ways for cog to handle files.
Cog defaults to returning base64 encoded data URLs for file outputs. This works in sync mode but as you've seen there's a bug in async-mode.
Cog supports an --upload-url flag which when provided to the web server on start will make a PUT request to that endpoint with the file content. It then expects that the server return a 2xx response with a Location header containing the destination of the file. This will then be included in the prediction body.
Hopefully the latter approach will unblock you for the moment while we look into the bug. Generally we've found that data URLs are good for experimenting but get unwieldy pretty quickly.
The --upload-url would look something like:
docker run -d -p 5000:5000 cog-hello-image python -m cog.server.http --upload-url=http://my-endpoint/uploads
The request made by cog will look like:
PUT /uploads/{filename}
Content-Type: {mime}
{data}
Hello, I’m making a POST request to the "predictions" endpoint with the
Prefer: respond-async
header and the webhook URL in the body. The webhook is working, and I’m receiving all events without any issues. However, I’m unable to figure out how to access the output path URL from the "succeeded" event via an HTTP server. When I try to access that URL, I get a 404 error with the message{"detail":"Not Found"}
.Here is the webhook "succeeded" request output:
Here’s the related code block in
predict.py
:Could someone help me understand how to access the output URL via an HTTP server?
The text was updated successfully, but these errors were encountered: