How Do I Locate an Upload Callback Failure?
How It Works
OBS upload callback allows the OBS server to automatically send an HTTP request to a specified callback URL after an object is successfully uploaded. The SDK supports upload callback for the following operations:
The SDK uses the extended parameter WithCallbackHeader to write the callback configuration to the x-obs-callback request header. After receiving the request, OBS initiates a callback when the upload is complete.
Troubleshooting Procedure
- Check whether the callback fails based on the HTTP status code.
Scenario
Returned Status Code
Description
Both the upload and callback are successful.
200
Normal. CallbackBody can be read.
The upload is successful but the callback fails.
203
The object has been stored, but the callback server returns a status code other than 200.
The upload fails.
err != nil
The upload fails, and the callback is not triggered.
If the status code is 203, the object has been successfully uploaded to OBS, but the callback fails. In this case, perform the following steps.
- Check whether the callback URL is reachable. The most common cause of a callback failure is that the OBS server cannot access the callback URL. Ensure that:
- The URL must be an HTTP/HTTPS address that is accessible over the public network.
- The callback server must return the 200 status code. Otherwise, OBS considers the callback failed.
Verification method: Use curl to simulate a callback request from an external network.
curl -X POST http://your-server.com/callback \ -H "Content-Type: application/json" \ -d '{"bucket":"test","key":"obj","etag":"abc"}' \ -vIf the curl operation fails, the callback service is unreachable. In this case, check the network configuration, firewall rules, and whether the service is running properly.
- Check whether the callback URL is URL-encoded. If the URL contains special characters, such as CJK characters, spaces, ampersands (&), and equal signs (=), URL encoding must be performed first. Otherwise, the OBS server may fail to correctly parse the callback URL, resulting in a callback failure.
- Check the logs of the callback server. If the callback URL is reachable but the callback still fails, check the logs of the callback server. Common issues include:
- Data not correctly processed: An error is reported when the server parses the callback request body. For example, the server does not recognize the format after template variables such as $(bucket) are replaced.
- No response body returned: The server successfully processes the request but does not return a response body, or returns a status code other than 200.
- Network timeout: The server takes too long to process the request, causing the callback on OBS to time out.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot