mongodbmeteorgitpod

Can't fetch data on Gitpod


I'm currently an intern in a company and I'm trying to create an environment to be able to use their app that consumes too much power to run on my computer.

I'm having a problem with my app running on meteor with mongodb.

When I launch my app on Gitpod, I have access to port 3000 on which my app is running and port 3001 on which mongodb is running is wide open. But when I have to fetch data from my db I can't do it.

When I run the app locally at the same time as on Gitpod, I can fetch the data of the db and it is the db that runs on Gitpod because when I modify the data nothing is modified in the db that runs locally.

How is it possible ?


Solution

  • Meteor is trying to access its backend through absolute URLs. In default dev mode it uses http://localhost:3000 which isn't reachable from your local browser when the endpoint is running in Gitpod. You need to set the ROOT_URL env variable to point to the public endpoint exposed by Gitpod. To do so execute

       export ROOT_URL=$(gp url 3000)
    

    in the terminal.