When uploading videos to LinkedIn via API we get very frequent 504 timeout errors. We have added in backoff and retry mechanisms, but still get a large percentage of failures due to this. We can manually retry the uploads and eventually they work without changing anything.
Anyone else navigate this issue? Anything we can do with our uploads to reduce or prevent these errors? Some of our upload code below:
data = self.session.post(
url="/assets",
params={"action": "registerUpload"},
json={
"registerUploadRequest": {
"owner": owner,
"recipes": ["urn:li:digitalmediaRecipe:feedshare-video"],
"serviceRelationships": [
{"identifier": "urn:li:userGeneratedContent", "relationshipType": "OWNER"}
],
"supportedUploadMechanism": ["SYNCHRONOUS_UPLOAD"],
}
},
)
upload_url = data["value"]["uploadMechanism"][
"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest"
]["uploadUrl"]
response = self.session.put(
url=upload_url,
headers={"Content-Type": "application/binary"},
data=media.file.open("rb"),
return_response=True,
)