Skip to main content

All Questions

Filter by
Sorted by
Tagged with
-1 votes
1 answer
462 views

How to 'evaluate' process.env values which are referenced in string values returned from a database request?

If I have HTML code within a document in a MongoDB database collection, which includes ${process.env.MY_VARIABLE}: { "page_name": "home_page", "page_content": &...
user1063287's user avatar
  • 10.9k
1 vote
2 answers
637 views

how to store sub account auth tokens twilio

I am using the MERN stack for an app im building. In this app im using twilio. I have decided to use twilio sub-accounts. The way this works is I create a MASTER twilio account that give me an ...
KingJoeffrey's user avatar
0 votes
1 answer
33 views

How to set env variable in Heroku with Node.js? how to do that? [closed]

I am trying to set an environment variable for socks proxy. This variable is dependent on ip and port. i.e. socks://23.244.534.344:8080 Issue is that in Heroku the port is dynamic. Unfortunately I ...
Hasif's user avatar
  • 1
1 vote
0 answers
514 views

Why is my process.env not working properly?

I am practicing MongoDB, which requires you to connect your terminal to MongoDB Atlas using a connection string. I am storing the credential parts of my connection string in .env file but it shows ...
Arpit Pandey's user avatar
1 vote
1 answer
1k views

Undefined connection string from non browser exposed environment variable MongoDB & NextJS (next-connect)

I'm having a problem with my mongodb connection string in my nextjs CRUD application in production. I followed this guide: https://www.mongodb.com/developer/how-to/nextjs-building-modern-applications/ ...
Rekkert's user avatar
  • 43
0 votes
2 answers
5k views

MongoDB Environment Variables Error, Unsure How to Proceed

I am trying to learn full-stack web dev, and I am trying to set up MongoDB database to local ENV variables, but I am having problems. I do not know how to connect the .env file to my server.js file. ...
CoderTang's user avatar
  • 500
0 votes
2 answers
450 views

Can't connect to a MongoDB server

I'm trying to deploy this Fullstack app to a DigitalOcean droplet: https://github.com/maismin/stock-portfolio-app-demo I installed MongoDB like how to documentation said and then I started it and didn'...
Carter McKay's user avatar
1 vote
1 answer
2k views

"TypeError: Cannot read property 'toString' of undefined" while connecting to mongodb using env variables

I am fairly new to full-stack, I started learning and making a demo site using node, express, and MongoDB. I was learning through youtube(WebDevSimplified). i connected my project to my MongoDB using ...
N.Sai teja varma's user avatar
8 votes
2 answers
12k views

TypeScript declarations for environment variables not being recognized

I am trying to connect to MongoDB when starting my node.js server. My server is in src/server.ts, connectDB() is in src/config/db.ts and my .env, and environment.d.ts are in the root directory. ...
lpritchard's user avatar
0 votes
2 answers
145 views

Unable to setup Environment variables seperately for prod and dev environment

I have my Node.js project having environment file setup like below let config = { apiVersion: "/api/v1", PORT: 3001, mongodb: { url: "mongodb://localhost:27017/BTracker", ...
kalyan veenam's user avatar
1 vote
2 answers
3k views

Confusion about how to set .env variable in node.js/express

So I've been trying to connect to my MongoDB database, and I had to make a process.env.MONGO_URI variable to store the connection URI, and I was getting very frustrated because it wasn't working when ...
user avatar
1 vote
1 answer
881 views

How to get Loopback 3 conditional 'datasources' and 'model-config': following instructions and doesn't work

Edit: I was able to get it to work partway, if I assumed that the 'local' variants could only overwrite already defined structures. That is, I need to define the data sources 'DynamoDB' and 'mongo' ...
Cerulean's user avatar
  • 6,053
1 vote
1 answer
1k views

connection to MongoDB via env variable returns DB_URL is not defined

I am trying to connect to my MongoDB database using a env variable that is in my config.env file so that I don't leave my connection string visible for everyone, but I keep getting the error that my ...
Mahma Deva's user avatar
6 votes
2 answers
15k views

Different env variables for testing and development in nodejs

I'm developing a nodejs api in my free time, and I'm trying to implement testing now. I'm currently loading my environment variables from a .env file (loaded using dotenv), which include the DB_URI, ...
Andreas L Orozco's user avatar
0 votes
0 answers
1k views

Mongoose.connect() - Environment Variables Best practices

I was wondering what code snippets you use, to connect to your DB via mongoose. I tried different approaches. Building a connection string, based on the node_env and a number of other env_vars ...
Nicolai Schmid's user avatar

15 30 50 per page