Bubble.io api calls not working

Suddenly all of my Bubble api calls to OpenAI, which were working perfectly fine, now give the HTTP 400 invalid request error.

Can you provide more details, such as whether you’re using a specific plugin for Bubble, and if so, the name of the plugin? Has it had any updates?

Also, you might want to consider posting this issue on the Bubble forum

Just using the standard Bubble API Connector. Things were working fine, then there was gradual degradation of performance over a few days, with increasing errors, and now nothing works, error every time. There was a previous episode which was resolved by creating a new secret key and installing that. But this time I also cannot generate a new secret key. Goes into a never ending stuck loading loop.

1 Like

Are you making sure everything (especially your content) is made JSON-safe in Bubble?

Hey! I’ve also been getting this error. It’s been intermittent - the same prompts that worked fine before are now throwing this error.

I’ve tried formatting as JSON safe for all dynamic inputs. I’ve even tried adding find & replace for a bunch of characters which may not be escaped properly or possibly missed by the builtin JSON safe formatting option in Bubble.

All the calls reintialize okay, so it must be the dynamic data coming in?

At the moment, it’s only the dynamic data I’m formatting as JSON safe.

I’ve also tried limiting max_tokens and keeping content short, as I read that it can throw this error if you exceed token limits (even if it’s nothing to do with JSON formatting). I’ve also made sure to point towards models with higher token limits.

I also noted that things have gotten worse with time, and haven’t tried a new secret-key yet. I feel like this is more of an issue on the Bubble side, but can’t be sure!

Help VERY much appreciated as my project really depends on this :pray:

Thanks!

I’m using it Bubble and OpenAI and dont have any issues using an API key (are you using the new project keys?) Also, if you have your own API connecter, you may want to check if you dont need to initialize them again?

Hey thanks for the reply.

I’m just using the Bubble API connector and had no issues in the beginning - I was mainly referring to @stevenvincentla comment about how the issue gradually worsened until they tried creating a new secret key, which fixed the issue temporarily.

I’ve tried reinitiailzing everything several times. Sometimes it helps, most times it doesn’t.

I just can’t figure out why the issue doesn’t happen every time. If it were a JSON issue or API issue, then it wouldn’t work at all, right?

I’m at a bit of a loss!

Have you tried just using a normal Authorization Bearer API code instead of a using a secret key?

fiz estes testes tambem e aparece o mesmo erro
meu body esta assim:
{
“model”: “gpt-4o”,
“messages”: [
{
“role”: “system”,
“content”: “Você é um assistente útil e atencioso.”
},
{
“role”: “user”,
“content”: “”
}
],
“max_tokens”: 999
}

e apresenta o seguinte erro:
“O serviço OpenAI - API Call retornou um erro (HTTP 400). Consulte a documentação para garantir que sua chamada esteja configurada corretamente. Erro bruto: { “error”: { “message”: “Não foi possível analisar o corpo JSON da sua solicitação. (DICA: Isso provavelmente significa que você não está usando sua biblioteca HTTP corretamente. A API OpenAI espera uma carga JSON, mas o que foi enviado não era um JSON válido. Se você tiver problemas para descobrir como corrigir isso, entre em contato conosco por meio da nossa central de ajuda em help.openai.com.)”, “type”: “invalid_request_error”, “param”: null, “code”: null } }”

nao consigo resolver. acredito que seja no bubble. e nao consigo nem testar a resposta assim kkk