Uncaught (in promise) DeepgramError #1003
Replies: 3 comments 1 reply
-
Hey there! It looks like you haven't connected your GitHub account to your Deepgram account. You can do this at https://community.deepgram.com - being verified through this process will allow our team to help you in a much more streamlined fashion. |
Beta Was this translation helpful? Give feedback.
-
It looks like we're missing some important information to help debug your issue. Would you mind providing us with the following details in a reply?
|
Beta Was this translation helpful? Give feedback.
-
I'm sorry for the inconvenience you're experiencing. The error message you're seeing is due to Cross-Origin Resource Sharing (CORS) restrictions in the browser. To resolve this, you can set up a server-side proxy to make the API calls. This means that your JavaScript code would send a request to your own server, and then your server would make the API call to Deepgram. The response from Deepgram would then be sent back to your server, and from there back to your JavaScript code. Here's a basic example of how you could set up a proxy using Node.js and Express: const express = require('express');
const axios = require('axios');
const app = express();
const port = 3000;
app.get('/transcribe', async (req, res) => {
try {
const response = await <http://axios.post|axios.post>('<https://api.deepgram.com/v1/listen>', {
url: req.query.url,
}, {
headers: {
Authorization: `Token ${YOUR_DEEPGRAM_API_KEY}`,
},
});
res.send(response.data);
} catch (error) {
res.status(500).send({ error: error.toString() });
}
});
app.listen(port, () => {
console.log(`Server running at <http://localhost:${port}`>);
}); In your JavaScript code, you would then make a request to your own server instead of directly to Deepgram: fetch('<http://localhost:3000/transcribe?url=https://dpgr.am/spacewalk.wav>')
.then(response => response.json())
.then(data => console.log(data)); Please replace
|
Beta Was this translation helpful? Give feedback.
-
I try to use the javascript API, with the following code:
But the line
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
always returns the following error:Uncaught (in promise) DeepgramError: Due to CORS we are unable to support REST-based API calls to our API from the browser. Please consider using a proxy: https://dpgr.am/js-proxy for more information.
where the link doesn't work. Could someone tell me what I have to do, to get my example running? I didn't find any information on this error message.
Beta Was this translation helpful? Give feedback.
All reactions