Discussions

Ask a Question
ANSWERED
ANSWERED
ANSWERED
ANSWERED
ANSWERED
ANSWERED
ANSWERED
ANSWERED
ANSWERED
ANSWERED

Is your server not working or am i doing something wrong? 502 Bad Gateway

Hi im trying to upload an audio file from elevenlabs (because you dont support the new v2 multilingual model for other languages) and then send it with the talk stream (the stream is active and connected) but i always get an 502 - Bad Gateway error, here is the error: ``` (node:15216) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time talk status response: Response { [Symbol(realm)]: null, [Symbol(state)]: { aborted: false, rangeRequested: false, timingAllowPassed: true, requestIncludesCredentials: true, type: 'default', status: 502, timingInfo: { startTime: 4666.184200048447, redirectStartTime: 0, redirectEndTime: 0, postRedirectStartTime: 4666.184200048447, finalServiceWorkerStartTime: 0, finalNetworkResponseStartTime: 0, finalNetworkRequestStartTime: 0, endTime: 0, encodedBodySize: 36, decodedBodySize: 36, finalConnectionTimingInfo: null }, cacheState: '', statusText: 'Bad Gateway', headersList: HeadersList { [Symbol(headers map)]: [Map], [Symbol(headers map sorted)]: null }, urlList: [ [URL] ], body: { stream: undefined } }, [Symbol(headers)]: HeadersList { [Symbol(headers map)]: Map(8) { 'date' => 'Sun, 29 Oct 2023 13:29:29 GMT', 'content-type' => 'application/json', 'content-length' => '36', 'connection' => 'keep-alive', 'x-amzn-requestid' => '14ccad85-0271-4925-b1e0-655e1e393d0b', 'x-amzn-errortype' => 'InternalServerErrorException', 'x-amz-apigw-id' => 'NkOpGGNevHcEqsg=', 'x-amzn-trace-id' => 'Root=1-653e5e39-6cc763730644319b5e6f6d8f' }, [Symbol(headers map sorted)]: null } } ``` I tried then to use your audio upload from the api reference and there surprisendly i get an success, but still i used that audio_url i got and send it with the talk Stream and still get an 502 - Bad Gateway. Wierdly before it was a 400 - bad Request but with the same code from your doc. Here is the api request code: ``` console.log(req.file) const audioFile = req.file const { streamId, sessionId, message } = req.body const formData = new FormData() formData.append('source_url', audioFile.path) formData.append('audio', createReadStream(audioFile.path)) try { const audioUpload = await fetch('https://api.d-id.com/audios', { method: 'POST', headers: { Authorization: `Basic ${process.env.DID_API_KEY}`, // accept: 'application/json', // 'Content-Type': 'multipart/form-data' }, body: formData, }) console.log(audioUpload) const uploadJSON = await audioUpload.json() const talkResponse = await fetchWithRetries(`${process.env.DID_URL}/talks/streams/${streamId}`, { method: 'POST', headers: { Authorization: `Basic ${process.env.DID_API_KEY}`, accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ script: { type: 'audio', // audio_url: 'https://d-id-public-bucket.s3.us-west-2.amazonaws.com/webrtc.mp3', audio_url: uploadJSON.url // audio_url: "s3://d-id-audios-prod/auth0|653563f5966d0e4e974a038f/KXe7fZQKkoxXO-bdOj9Fo/elevenLabsAudio.wav", }, config: { stitch: true, }, // session_id: sessionId, }), }); console.log('talk status response: ', talkResponse) } catch (error) { console.log(error) res.status(500).json({output: 'An Error appeared on talkToStream Route.', error: error}) } }; ``` The Audio should not be the problem because it worked on your site. I tried to use normal node fetch and your api, to talk to the stream but still same result. I noticed when i wanted to use your api for audio upload (api.uploadAnAudio()) i get an error that this doesnt exist on the api. Just wanted to mention that. I tried to use your talk to Stream api reference on the page but even there i get an 502 Bad gateway. But there i couldnt remove the provider in the script object, so i dont know if that was a reason. I hope you can help me.