In short, I have an API endpoint setup that shows a proper response in both the raw format and on the initialization call. However, inspecting the response yields empty values when previewed on my site.
It’s the exact same problem as what @hirscr posted here:
API tests out, but returns nothing
My questions are:
Has this in fact been identified as a bug?
Does anyone know of a workaround?
Can you give access to your app and maybe add some screenshot?
Thanks for the response. Unfortunately the app contains quite a bit of sensitive data, but these screenshots should be helpful. The list in question are the “OpportunityLineItems” and their records. It’s connected to a Salesforce API.
Here the API connects correctly, and successfully matches up responses
Here’s the raw data:
Finally an inspector screenshot showing the same record with empty fields:
Can you make the same request in postman or insomnia and return full result?
A thing that I see is that OpportynityLineItems, the first item seem to be named “Projects OpportunityLineItems” record while the second is just named Projects record. And I’m not sure what you hide in red in the last screenshot. But if this is dynmically created, you will get issue because the field will always be different.
What I believe is that the OpportunityLineItems record doesn’t return what is set on the API Connector (first screenshot) and return what you see with Projects record - 2. Because the name is different, it doesn’t appear.
It’s hard to be sure what is the issue exactly without playing with it, but I think that you can start from that and check if this may explain your situation.
Thanks again for the response. This is an interesting observation about the names being different. I hadn’t noticed it myself, but I’m not sure this can be changed. The names are not dynamic from the Salesforce side, but it appears that Bubble is appending the API call name to OpportunityLineItems:
In any case, I hear you on not being able to toy around with this. I’ll create a Salesforce sandbox with some dummy data and connect it up to a public Bubble site. I should be able to duplicate the issue and open it all up this way. Very much appreciate the attention thus far; I’ll post again once it’s all available.
@Jici Okay it’s all setup for testing now, here:
Same issue as before, API calls just fine and shows a raw response–but shows up with empty values for OpportunityLineItems in bubble.
Thanks for the help; just let me know if you need anything else!
I think I fixed it.
Here’s what happen:
The first element returned by the call return something in OpportunityLineItems (few fields and an array).
But the second and a lot of other element return null.
Bubble consider this like it is “two” fields. One with an array (and set this correctly to an array) but because the other are null, he add another field with the same name and set it to “text”. This create a conflict between both.
I just set Ignore field in the last one (from item returning null) and everything seem to work fine now.
I never would have guessed to do that in a million years. Thank you so much, Jici!