Unexcepted behaviour on SAFARI with @cube.js/core and unreadable error message
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
Hello everybody. We are a team of devs working with cube for several months now and we are really really happy with it. It's always delivering and easy to use. But recently, we stumbled upon a bug only on SAFARI browser.
**Describe the bug**
On Chrome or Firefox, everything is fine. But on safari, we use the Cube.js method "load" to retrieve the simplest data possible from Cube. But we receive the following error on the console :
`undefined is not an object (evaluating 'response.results.length')`
We tried few things to debug this issue. First of all, the errors occurs in the following function :
```javascript
loadResponseInternal(response) {
if (
response.results.length &&
response.results[0].query.responseFormat &&
response.results[0].query.responseFormat === ResultType.COMPACT
) {
response.results.forEach((result, j) => {
const data = [];
result.data.dataset.forEach((r) => {
const row = {};
result.data.members.forEach((m, i) => {
row[m] = r[i];
});
data.push(row);
});
response.results[j].data = data;
});
}
return new ResultSet(response, {
parseDateMeasures: this.parseDateMeasures
});
}
```
Here, the response object (received from network) does not contain a "results" object.
So I tried to understand what does this object contain instead ? Using the safari debugger, I noticed that the "response" object I receive is structured like this :
`{
error: "[object Blob]"
}`
It's impossible to read the error object to try to understand what's going on.
From there I asked myself : maybe there is an error in my request or in my cube cloud environment.
On chrome and firefox, the exact same request produces no error.
Also, when I open the network tab of Safari's developer tools, I can see the GET request and more importantly I can see that I correctly receives data from cube on that request. So the error is probably on the response parsing somewhere.
I also tried to look at Cube Cloud logs, but there is nothing there.
**Expected behavior**
The JS SDK should parse correctly the response object (if it's a success or an error) in Safari and extract either a ResultSet or an error object.
```javascript
const result = await cubejs.load({
measures: ["Campaigns.spend"],
order: {
"Campaigns.date": "asc",
},
});
console.log(result);
```
**Version:**
"@cubejs-client/core" : "^0.31.46"
Contributor guide
Assessment
This issue has not been assessed yet.