#AxiosError: Request failed with status code 401

1 messages · Page 1 of 1 (latest)

lone venture
#
const url =
            "https://api.elevenlabs.io/v1/text-to-speech/EXAVITQu4vr4xnSDxMaL/stream";

        const headers1 = {
            Accept: "audio/mpeg",
            "Content-Type": "application/json",
            "xi-api-key": "i just hided the api key",
        };
#

everything was working fine until this error

lone venture
#

@odd steppe

odd steppe
#

Please log the actual body of the error

#

error 401 can be many things

lone venture
#

response: {
status: 401,
statusText: 'Unauthorized',
headers: Object [AxiosHeaders] {
date: 'Mon, 18 Dec 2023 17 41 GMT',
server: 'uvicorn',
'content-length': '216',
'content-type': 'application/json',
'access-control-allow-origin': '',
'access-control-allow-headers': '
',
'access-control-allow-methods': 'POST, OPTIONS, DELETE, GET, PUT',
'access-control-max-age': '600',
via: '1.1 google',
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
connection: 'close'
},

odd steppe
#

The body of the response should have more details

odd steppe
#

that's not the body - I'm not sure how to long it using axios, however

odd steppe
#

there isn't? Strange.

lone venture
#

its so long i cant send it here

#

the code was working fine and i did not edit it and i got this error

#

@odd steppe

lone venture
#

did i reached my limit of characters ?@odd steppe

odd steppe
#

I don't know - that's why I asked for the error body