Ricerche recenti
Nessuna ricerca recente

Divya Chauhan
Data ingresso 28 gen 2025
·
Ultima attività 28 gen 2025
Seguiti
0
Follower
0
Attività totali
1
Voti
0
Abbonamenti
0
PANORAMICA ATTIVITÀ
BADGE
ARTICOLI
POST
COMMENTI NELLA COMMUNITY
COMMENTI AGLI ARTICOLI
PANORAMICA ATTIVITÀ
Ultima attività di Divya Chauhan
Divya Chauhan ha creato un post,
Hi Everyone,
I'm using Zendesk Help Center Attachments API to add attachments to an article. However, some uploads fail randomly with 500 error (Internal Server Error for API: ). The failures vary each time I attempt, both in the specific attachments and the number that fail. Re-publishing succeeds for previously failed attachments but causes others to fail. I've added retry of failed API calls which gives 500 error & for them I get success. When I compared the Request header of failed api call and the one send using replay XHR featue of network call in devtools, they were same for failed & success calls. Even the binary data send is same on comparison.
My guesses are its due to Temporary Server Overload issue / Race Conditions / Concurrency Limitations , but couldn't find any supporting documents if this is the real root cause , can anyone please guide me into right direction ?
I'm trying to upload attachments while uploading content to zendesk Help Centre API, which are 10 parallel api calls, meaning, I make 10 api callso to below curl and wait for there response and then make further 10 api calls, untill all the content is uploaded. I've also tried reducing to 3 parallel API calls, same error is reproduced over there as well. For faster uploading the content, I want to support parallel API calls
Curl: curl --location 'https://adobe7546.zendesk.com/api/v2/help_center/articles/24164966574354/attachments.json' \
--header 'authority: adobe7546.zendesk.com' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Basic ' \
--header 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Electron/12.2.3 Safari/537.36' \
--header 'sec-fetch-site: cross-site' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-dest: empty' \
--header 'accept-language: en-US' \
--header 'cookie: ' \
--form 'inline="true"' \
--form 'file='
API URL:
https://adobe7546.zendesk.com/api/v2/help_center/articles/23838113722642/attachments.json
Our Code, we are calling makeAttachmentApiCall
() function:
import fs from 'fs'
import axios, { Method } from 'axios'
import * as _ from 'lodash'
function uploadAttachment(api_url,bodyFormData,noOfRetries=10){
return axios.post(api_url, bodyFormData, {
headers: {
"Content-Type": "multipart/form-data",
...this.defaultUrlparams.headers
},
auth: {
username: this.user,
password: this.password
}
})
.then((result) => {
console.log(result)
})
.catch((err) => {
console.log(err);
if(err && noOfRetries<=10){
return _.delay(() => {
uploadAttachment(api_url,bodyFormData,file, ++noOfRetries)
.then(result=>result).catch(error=>error)
}, noOfRetries * 1000)
}
if(err) {
console.error("failed to upload file " + file + "," + err)
}
return error
});
}
async function makeAttachmentApiCall(){
const bodyFormData = new FormData()
bodyFormData.append('inline', isInline)
const buffer = fs.readFileSync(file);
const blob = new Blob([buffer], { type: mime.getMimeType(file) });
bodyFormData.append('file', blob, path.basename(file))
await uploadAttachment(api_url,bodyFormData)
}
where api_url looks like = https://adobe7546.zendesk.com/api/v2/help_center/articles/24175204782354/attachments.json
where file is of type string with absolute file_path like “/Users/divyac/Documents/My RoboHelp Projects/outputs/About RoboHelp/Zendesk/assets/images/BadgeTip.png”
Response:
{"body":"{"status":500,"error":"Internal Server Error"}"
Data ultima modifica: 28 gen 2025 · Divya Chauhan
0
Follower
2
Voti
1
Commento