1

I'm taking over a website. The previous developer decided to use cube.dev to build the KPI page. But I have no knowledge on it.

He showed me once the KPI page worked. But now, when I launch it on my side (https://jsaddin.10studio.tech/kpi), there is an error: GET http://localhost:4000/cubejs-api/v1/load?query=%7B%22measures%22%3A%5B%22Customs.count%22%5D%2C%22dimensions%22%3A%5B%22Customs.offerdisplayname%22%5D%2C%22timeDimensions%22%3A%5B%7B%22dimension%22%3A%22Customs.timestamp%22%2C%22dateRange%22%3A%22this+week%22%2C%22granularity%22%3A%22day%22%7D%5D%7D net::ERR_CONNECTION_REFUSED

enter image description here

I also see in his code:

const cubejsApi = cubejs(
  'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NzE0OTIxNzYsI...',
  { apiUrl: 'http://localhost:4000/cubejs-api/v1' },
);

I cannot reach the developer anymore. Does anyone know what may the reason of the problem?

SoftTimur
  • 5,630
  • 38
  • 140
  • 292
  • It looks like you're trying to call localhost:4000 on your live domain. Are you running a localhost:4000 on your server? – Ozzy Feb 19 '20 at 00:30
  • I guess he did not launch `localhost:4000` on our server. I guess he showed me his test page in his local disk. I have all the code, where could I run `npm run dev` to launch `localhost:4000` on my local disk? – SoftTimur Feb 19 '20 at 00:38
  • Usually you would only run a dev server locally, but have a production server to run your framework on your web host. This is specific to your project setup, maybe a better pointer would be a guide on how to deploy cubejs (e.g. https://cube.dev/docs/deployment). – Ozzy Feb 29 '20 at 23:49

1 Answers1

0

Just change apiUrl to point to the production Cube.js API endpoint or just to the root if it's the same host:

const cubejsApi = cubejs(
  'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NzE0OTIxNzYsI...',
  { apiUrl: '/cubejs-api/v1' },
);
Pavel Tiunov
  • 1,163
  • 6
  • 8