Incorrect API Call return - Non-object delivered JSON expected

Use case: API connector used to access Azure OPEN AI resource to create web application that allows to chat with my own data

Problem: API returns non-object that cannot be further processed in my workflow

  • API connector error message:
    There was an issue setting up your call.
    The API call returns a non-object and you picked JSON. Please check.
  • Error message page preview:
    Error parsing data from Apiconnector2

what i have done so far:

  • Access/authentification checked: works finely,
  • Returns from “my” chatbot are fine (from what i can see in the details of the received return)
  • My chat with Microsoft revealed that there is no issue with the AZURE resources: the service guy showed me that he receives json formatted returns without any error codes in a troubleshooting session.

** My API Call configuration:**

Normally, this is because you didn’t select the correct data type (top right). The server probably only return a 200 answer but no payload? Switch to empty. If this is not empty. Please share the payload returned

Hi Jici,
thanks for having a look at it. Here is what i receive when i set the data type to “empty”:

`{
“body”: null,
“headers”: {
“cache-control”: “no-cache”,
“transfer-encoding”: “chunked”,
“content-type”: “text/event-stream”,
“x-envoy-upstream-service-time”: “2629”,
“apim-request-id”: “7cbd2c90-cdf7-4bbf-91fe-6a2020780241”,
“strict-transport-security”: “max-age=31536000; includeSubDomains; preload”,
“x-content-type-options”: “nosniff”,
“x-ms-region”: “East US”,
“x-ratelimit-remaining-requests”: “119”,
“x-ratelimit-remaining-tokens”: “116000”,
“date”: “Thu, 25 Apr 2024 16:41:10 GMT”
}

The returned message when i set it back to json is (error message from the actual web preview):

Error parsing data from Apiconnector2: "data: {"id":"de3c5427-ca4f-47a8-85c2-1f97f07c49c4","model":"gpt-35-turbo-16k","created":1714063535,"object":"extensions.chat.completion.chunk","choices":[{"index":0,"delta":{"context":{"messages":[{"role":"tool","content":"{\"citations\":[{\"content\":\"Title: public_sap_business_bydesign_manual_full.pdfThird-Party Order Processing — Customer Return [page 4634]\\n6.4.3.14.1.2 Sales Order Processing\\nOverview\\nThe sales order process involves creating sales orders for products or services according to specific terms\\nwith fixed conditions. The sales order is usually created by a sales employee, and can be generated out of a\\nsales quote, a sales contract, or an opportunity. The system supports pricing functionality and a check of the\\navailability of products. The cost of sales can be determined using product valuation, which enables the seller\\nto evaluate the profitability of the sales order. If services are needed to fulfill the sales order, service items\\ncan be added. …

The output does make sense so far, but the format is hindering me from processing it further.

The problem is:

The API doesn’t return an application/json content-type. Bubble doesn’t know what to do with this concent-type and give you an error. If you can change it in azure, do it, if not, you can always set it to “text” instead of json and use one of the JSON plugin available or regex to parse the response.

Hi Jici, thank you for the explanation. Very helpful.
I did the following: i changed to the latest AZURE API version and, all of a sudden, it works.

So, I guess it was something on AZURE’s side.

Cheers,
Lars

1 Like

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