My API connects to my Azure SQL database, which shows a 200 from my database but a 400 on bubble’s end:
Below is the only explanation I can think of for why this happens, based on Bubble’s API connector documentation:
“API Connecter calls are by default sent from the Bubble server (for non-dedicated Bubble apps) and thus susceptible to 3rd party API rate limiting since the rate limit is shared across all Bubble apps.”
400 error shouldn’t be related to a rate limiting API service error. Recently, there’s some error with API connector so it may be related.
Can you share the API Connector settings for this call?
The error is related to bubble’s server (whether due to rate limiting specifically or not) because the calls show as 200 on my Azure monitor, but 400 on the browser side on bubble.
Rate limited should show in Azure too and the code should be 429.
It could be a timedout issue (from Bubble waiting for azure function to complete) but I don’t think it should return 400 error but 504 (or something like that). Not impossible that Bubble is not able to parse the response. Is the response always the same?
Yes, the response is always the same and therefore not a parsing issue.
When I said “rate limit”, I didn’t mean a rate limit from my own API, but a rate limit from bubble’s API since their “doapicallfromserver” server is shared across all non-dedicated apps, as per their documentation that I included in OP.
But regardless of the specific server reason, such as rate limit or timeout, the issue is with bubble’s server since my API shows 200 and bubble is the 3rd party between my API and the browser.
As a solution, I tried to remove bubble’s server out of the equation by making the API call directly from the user’s browser using the “Attempt to make the call from the browser” option on the API connector config.
However, that browser option returns the below “expected a 2XX statusCode but got 0” error that bubble users have been reporting since 2021.
Do you know of any workaround for the above browser-side error?
What Bubble mean by that in documentation, is that API service you are trying to fetch could return rate limit error because all call are made from shared server. But it’s not related to doapicallfromserver that is a Bubble function.
Also, because azure return 200, the only thing I can see is that there’s an error between Azure and Bubble after the request, so probably with the response. Could be a parsing error or Bubble doesn’t wait enough time to get the response. Any info on how many time your azure function take to run? FWIK, you shouldn’t be able to do call from browser because you have an header.
Rate Limit: Ahh I see. Yes that rate limit comment makes sense now, since multiple bubble Apps could be trying to return data from OpenAI’s API as an example.
Browser Side: Yes. The browser call is from a different “api_test” and not from the initial “firm” API that I am receiving the 400 error on.
No I don’t know solution for that and I don’t use this function most of the time because most API request authorization. So not very familiar with this issue. Sound like a bug from Bubble, another one that they didn’t fix after releasing a new feature…(and it’s a very old feature now…) I don’t know which response people got when they send a support ticket about this error… Some user in the topic said they need to reinitialize the API call. Maybe start from scratch? A reason why this error happen may be this one: API call without headers
To re-visit the API Connector’s ‘Attempt to make the call from the browser’ as a final attempt, does the “expected a 2XX statusCode but got 0" seem like a possible error that I’m making?
"Access to XMLHttpRequest at ‘https://{x}.azurewebsites.net/api/api_test’ from origin ‘https://{x}.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Given that ‘Attempt to make the call from the browser’ is only available with no headers are set, and a ‘Access-Control-Allow-Origin’ header is required, does that make the client side option impossible then?
You need to set this on azure set to allow CORS request. This is a browser security. You may not face this issue in firefox for example because each browser have different rules for CORS request.