Unable to access Mongo DB instance from Node.JS
mvz00
HOBBYOP

a year ago

I have two instances, one a docker instance running a node app and the other a mongodb instance. I have tried to create the cross environment variable per the railway documentation but it’s empty when I try to access it via node. Any idea what I might be doing wrong?

Variable created on the node instance is MONOGO_URL = ${{ mongodb.MONGO_URL}} I have also tried using the deployment name ${{instance-name.MONGO_URL}} but neither work. I can access local variables correctly.

8 Replies

a year ago

The database and service need to be in the same environment.


mvz00
HOBBYOP

a year ago

Sorry I mistyped that, they are in the same environment but different instances


a year ago

They are not in the same environment.


mvz00
HOBBYOP

a year ago

Why do you say that? I only have one environment called “production” and both instances are listed underneath it?


mvz00
HOBBYOP

a year ago

Only one environment in per the attached screenshot so how can they be in different environments?

Attachments


a year ago

The environment contains only a database, there is no app service in that environment.

They are in separate environments.

Both services need to be in the same environment.


mvz00
HOBBYOP

a year ago

This one is also in the production environment

Attachments


a year ago

Those are two completely different environments in two completely different projects.


Loading...