1

I'm having some trouble fetching data from my API in both the async fetch() hook and async data(). I get the error: "Error: connect ECONNREFUSED". If I try to fetch the data in the mounted() hook instead, it works normally. I've built the API in Lumen and when I've tried with a different API(which I've also built in Lumen and is running online) it also worked normally. I'd assume the problem is in the API, but I don't understand how is it working in mounted() then. I've tried using both axios and $http and I get the same result.

UPDATE I've tried putting in "fetchOnServer: false" and it works like that, so it looks like the problem is with fetching data on the server side.

  • I have some components that only work in a deployed page when I use `"fetchOnServer: false"` on them. Others, if I add `"fetchOnServer: false"` it breaks my Jenkins build, but nothing in the logs says what it is. – King Holly Oct 29 '20 at 06:01

1 Answers1

0

If someone sees this and has the same problem, the solution for me was to start the lumen application with: php -S 127.0.0.1:8000 -t public instead of php -S http://localhost:8000 -t public