Pradumnasaraf / OpenSource-API

A free and public Open Source API.

Home Page:https://opensourceapi.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Cannot receive response from GET request for list of all devtips

at-the-vr opened this issue · comments

Description

Hey Pradumna, while exploring your API I found that the GET /api/devtip endpoint results in no response in its current state and keeps on waiting.

API Client in Use: Thunder Client v2.6.0
Browser/OS in Use: Chrome/Windows 10 (I am running this on Localhost setup at current time)

The Home page endpoint was working pretty smooth during my exploration. Even the /api/devtip/:id endpoint was giving me the error response for incorrect ids.

Screenshots

No response

Hey! contributor, thank you for opening an Issue 🎉.

Soon one of our maintainers will review it and provide you with feedback/suggestions. If you think it's something urgent, feel free to reach out Pradumna Saraf on Twitter. Star ⭐ this repo to show us support.

Happy, Open Source!

Hey,

Thank you for opening the issue. That was weird behaviour from Vercel's side. I have redeployed the API. Can you test again those Routes?

I gave it a try yesterday night and this morning as well, still not getting any response ? am I doing it wrong ? I believe the whole URI would be http://localhost:9009/api/devtip with a GET method right ?

Hey,
How are you running it? With Docker or local setup. If you have a local setup, check if the Mongo is running, and make sure you have copied the env. (Check the steps in the README)

I checked on two systems everything is fine. Also, you should get this message in the console.

Screenshot 2023-04-09 at 10 42 18 AM

Also, here is the testing video

Screen.Recording.2023-04-09.at.10.39.57.AM.mov

Managed to found that I am not getting Successfully connected to MongoDB cause of this Issue ⏬
image

  • This is all in a localhost setup without the docker compose method
  • Changing the MONGDB_URL (suggestion taken from Stack Overflow, MONGODB Forums) results in code: 'ERR_INVALID_URL'. Not sure how to diagnose this 😞
  • Changing the MONGDB_URL (suggestion taken from Stack Overflow, MONGODB Forums) results in code: 'ERR_INVALID_URL'. Not sure how to diagnose this 😞

I think your Mongo is not running check the solution on how to do that.

that's true, so i went with the docker method and what i get is this ⬇️
image

Is that meant to do so, cuz your response has couple of devtips

Is that meant to do so, cuz your response has couple of devtips

Yes, because I have added some via post request. You can also add data to DB by creating a POST req path /api/devtip with the body (JSON)

{
 "message": "Your message or devtip"
}

I am closing this as this is resolved. Also, when you are able to add and get data, let me know by commenting

Managed to found that I am not getting Successfully connected to MongoDB cause of this Issue ⏬ image

  • This is all in a localhost setup without the docker compose method
  • Changing the MONGDB_URL (suggestion taken from Stack Overflow, MONGODB Forums) results in code: 'ERR_INVALID_URL'. Not sure how to diagnose this 😞

I was bit confused with the localhost method, cause I can still receive the MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 error and from what I have tried, the Docker method and the localhost method are completely separate right ?
I followed the readme, copied the env variables, installed the dependencies with npm i, ran the server with npm run dev, what's the reason that it refuses for connection ?

I was bit confused with the localhost method, cause I can still receive the MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 error and from what I have tried, the Docker method and the localhost method are completely separate right ?

Yes, when running an app and MongoDB inside a container, so different from local dev, not Localhost. 'Localhost' refers to running the website on our local system. However, we still use the 'localhost' URL to talk to the API even when running with Docker. I think your issue might be with MongoDB. It might not be installed or try reinstalling it.

I followed the readme, copied the env variables, installed the dependencies with npm i, ran the server with npm run dev, what's the reason that it refuses for connection ?

Mongo issue as I told you.

Hi Pradumna I just wanted to summarize the diagnosis for this Issue, Docker is the best way to run this Application right ? cause performing localhost setup would not connect MongoDB with App

Docker is the best way to run this Application right ?

Yes

cause performing localhost setup would not connect MongoDB with App

No, you can run Mongo locally as well. Here is the link - https://www.mongodb.com/try/download/community