Issue calling API from a backend workflow

Hi there,

I’m running into an issue that I can’t seem to find a solution for online. It seems that there might be a bug, but I’m not 100% sure.

Here’s what’s happening.

I have an API call to OpenAI in the API connector which works fine with I initialize the call, and also if I call the API from a page workflow.

However, if I call the API from a backend workflow, I’m getting an error that the JSON is not correct.

However, the JSON I’m sending should be correct. And if I copy and paste that JSON into the API connector as the field I’m sending it to, the API connector works.

Does anyone know about issues or things to be aware of when sending data to the API connector from a backend workflow?

Copy paste the request JSON into a JSON validator to double check there are no syntax errors (https://jsonlint.com/)

If there are errors then you have a syntax problem. The next step is try recreating the API call in Postman (you should always develop your API calls in Postman or a similar software before trying it in Bubble).

Once it is working in Postman, copy and paste exactly all of the headers and body information. Make sure to set authorization to None or Self Handled. Report back if that does not work.

Nope, there are no errors (already checked jsonlint.com).

The API call works when called from a page workflow and also it initializes correctly. The only issue is when calling it from a backend workflow.

I submitted a bug to Bubble but curious if anyone has come across this before.

I have an api call to OpenAI that runs fine. Only thing I might suggest and be sure that there aren’t any line breaks. They would be json-friendly but OpenAI seems to reject that. OpenAI will send them but then reject them when you send them back with the conversation history.

Before submitting a bug, it’s best to see if it’s working in postman. It’s very common for developers (including me) to make small mistakes. Create a brand new API call of the same sort after it’s working in Postman with the same exact headers and body information. If it’s still not working after that, you should send screenshots of the request data. But still, in these kinds of situations that seem like bugs the best thing to do is start from scratch.

This topic was automatically closed after 14 days. New replies are no longer allowed.