0

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 ?

Jggb
  • 3
  • 1
  • 1
    Weclome to SO. Can you please elaborate a bit more on `I can't do it`? Is there any related error coming up? If not, what is actually the returned value on the fetched data`Where do you fetch it? If you are a bit more specific someone may be able to reproduce your issue and find a specific answer. – Jankapunkt Apr 23 '20 at 16:46
  • Thanks ! My app can't fetch data from : http://localhost:3000/__meteor__/dynamic-import/fetch . I tried to modify the URL_ROOT environment variable by giving it the value of the url given by Gitpod but I still have the same error: POST http://localhost:3000/__meteor__/dynamic-import/fetch net::ERR_CONNECTION_REFUSED – Jggb Apr 24 '20 at 10:05
  • This errorr is not about fetching data but usually a problem with `dynamic-import`, very likely a `cors` issue or your connection is not established due to any webserver restrictions. – Jankapunkt Apr 24 '20 at 10:07
  • Ok thanks for your answer. So do you think I have to whitelist the gitpod url so the app can access the db? – Jggb Apr 24 '20 at 11:17

1 Answers1

0

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.

Sven Efftinge
  • 3,065
  • 17
  • 17