Discussions

Ask a Question
Back to All

I'm getting a 500 internal server error while creating stream

this is my code

const options = {
method: 'POST',
url: 'https://api.d-id.com/talks/streams',
headers: {accept: 'application/json', 'content-type': 'application/json',"Authorization": Basic ${DID_TOKEN_ONE}},
data: {
face: {top_left: [0, 0], size: 512},
config: {motion_factor: 0, align_expand_factor: 0, stitch: true},
source_url: 'https://i.ibb.co/RYKFZF0/rdj-avatar.jpg',
// driver_url: 'string'
}
};
console.log("hey");

	const response = await axios.request(options);  
	console.log("response fetched", response.satus);  
	res.status(200).json(response.data);  
} catch(error){  
	console.log(error);  
	res.status(333).json(error);  
}

and this is the output I got:

{
"message": "Request failed with status code 500",
"name": "AxiosError",
"stack": "AxiosError: Request failed with status code 500\n at settle (/home/mohammed/Documents/explore_next_js/node_modules/axios/dist/node/axios.cjs:1913:12)\n at IncomingMessage.handleStreamEnd (/home/mohammed/Documents/explore_next_js/node_modules/axios/dist/node/axios.cjs:2995:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1359:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"adapter": [
"xhr",
"http"
],
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Basic cm9uaWRpZDU2MUBnbWFpbC5jb20:WgE_GKuEnUBZekSRhxfPD",
"User-Agent": "axios/1.5.1",
"Content-Length": "160",
"Accept-Encoding": "gzip, compress, deflate, br"
},
"method": "post",
"url": "https://api.d-id.com/talks/streams",
"data": "{"face":{"top_left":[0,0],"size":512},"config":{"motion_factor":0,"align_expand_factor":0,"stitch":true},"source_url":"https://i.ibb.co/RYKFZF0/rdj-avatar.jpg\"}"
},
"code": "ERR_BAD_RESPONSE",
"status": 500
}