"The callback configuration is not json format" error during an OSS upload callback
Problem description
When you use the upload callback feature of Object Storage Service (OSS), a request that includes callback parameters returns the following error message.
<Error>
<Code>InvalidArgument</Code>
<Message>The callback configuration is not json format.</Message>Problem cause
The callback parameter must be a Base64-encoded JSON string. This error occurs because the callbackBody parameter is not in a valid JSON format after you set the callbackBodyType parameter to application/json.
Solutions
The Content-Type of a callback request supports application/x-www-form-urlencoded and application/json. The default value is application/x-www-form-urlencoded. If the value of callbackBodyType is application/x-www-form-urlencoded, variables in callbackBody are replaced with URL-encoded values. If the value is application/json, variables are replaced based on the JSON format. For more information about how to set OSS callback parameters, see Callback. Adjust the parameters as follows:
Method 1: Set the callbackBody parameter to a value in a format similar to the following:
"callbackBody":"{\"bucket\":${bucket},\"object\":${object}}"Method 2:
Set
callbackBodyTypetoapplication/x-www-form-urlencoded.Set the callbackBody parameter to a value in a format similar to the following.
"callbackBody":"bucket=${bucket}&object=${object}"
References
For examples and common issues with OSS upload callbacks, see Common errors in upload callbacks and how to resolve them.
Applies to
Object Storage Service