Here’s the name of the site (https://we-opticians.netlify.app/) … I couldn’t figure out how to debug so I would really appreciate it if you could do this for me…
I have managed to figure out what could be causing the issue but I can’t really understand why…
I’ve created a repo with the bare minimum to replicate the issue. I have a fetchPosts function in the ./lib/api.js and when I call it (it’s the only thing I am doing) it recreates this issue…
There’s no environment variables supplied in the repo.
Is there something that VITE_WP_POST_URL and VITE_WP_BLOGPOST_URL should be set to, to bypass the fact that API_URL and BLOG_URL are quite simply undefined?
they are both similar… both were apis to access Wordpress data… one of them was for a post and the other a custom post… so you can use the same link for both… I couldn’t share the original urls as the data was from a client’s site… but like I said the data is very similar… it’s from wordpress…
and it seems to be working fine… so I assume, it’s something the code earlier which was causing the issue… however the issue is it works fine on netlify… but just not fine on the localhost…
I understand that the issue you’re experiencing is only with netlify dev, I’ve only been trying to also run the minimum replication provided locally to see if I also encounter it.
is there an option where I could send you the routes in the URL in a private message?
I realised there’s an ongoing loop when I am trying to debug… but I can’t seem to figure out why or how… I’d appreciate someone else looking at it … it would be easier to spot the bug…
Please do check and let me know… here’s something I found out which I found weird…
The for loop in the api.js is basically collection 10 posts at a time from the URL in data and then populating the posts array…
When I run npm run dev it works fine… it loops as many times as expected… but when I run netlify dev the loop doesn’t stop… you can check this my using console.log inside the loop …
And with the never ending loop, it looks like the netlify dev can’t go ahead… let me know if you had the same experience…
by the way the totalPages variable = 1 is just for development as otherwise I use the other option on production is makes the totalPage go to 51…;-)… as there are more than 500 posts…
@alimbolar I received the values that you private messaged and have confirmed they work.
I’ve also confirmed the same issue that you describe, where it gets stuck waiting for port 3000.
I’m not precisely sure why it’s occurring as I’ve never used netlify dev myself, but after consulting the documentation here:
I’ve found that it doesn’t get stuck when there is a netlify.toml file in the root containing: