where can i see the environment variables or credentials in the repo i am not good in coding. Can i use my own crtedentials to execute the code? This is for solar-system nodejs and mongodb source code. Its getting failed in testing phase as i am using my own credenetials.
i tred using the below credentials also as per the lab, but still giving authentication issues.
mongodb+srv://supercluster.d83jj.mongodb.net/SuperData
superuser
superpassword
yeah got it . Thanks. now the application is runing on my local machine, but there is some problem in the application. Whenever i am giving any number within 0-8 it is throwing error.
for my application when i am checking dependency issue it was showing critical for mongoose as well. so i made two changes in the dependency after which the critical went away.
my dependencies:
“@babel/traverse”: “^7.23.2”,
“mongoose”: “^6.13.8”,
above 2 dependencies were throign critical issues with versions so i updated.
is it because there is no data in the db? i need to seed the data to the db? Can you clarify? But there are no such seeding steps shown in the lab. when they started the application it was working well and good.
The database has data in it. Most likely there’s still an issue with your credentials. You do need to make sure that Jenkins is configured to put the URL, the username and the password into the environment. Again, case matters for the paramters.
i tried all possible ways including the one u mentioned above. Not at all getting. Let me know one thing do i need to do any mongodb installation in my server or so for this project? Not sure where it is going wrong. If you proper github, can u send me i will clone that and try.
Is therre any specific node versions required?
ubuntu@ip-172-31-17-111:~/solar-system$ nodejs --version
v18.19.1
ubuntu@ip-172-31-17-111:~/solar-system$ npm --version
9.2.0
Now, to make it obvious that we’re running the test, I change the script in package.json for “test” to this: "test": "mocha app-test.js --timeout 10000 --exit". This is to use the default reporter, which is easier to see in the command line.
I source a file to add the credentials to the environment:
$ npm test
> Solar [email protected] test
> mocha app-test.js --timeout 10000 --exit
Server successfully running on port - 3000
Planets API Suite
Fetching Planet Details
(node:38937) [DEP0170] DeprecationWarning: The URL mongodb://supercluster-shard-00-00.d83jj.mongodb.net:27017,supercluster-shard-00-01.d83jj.mongodb.net:27017,supercluster-shard-00-02.d83jj.mongodb.net:27017/superData?authSource=admin&replicaSet=atlas-11b0vt-shard-0&ssl=true is invalid. Future versions of Node.js will throw an error.
(Use `node --trace-deprecation ...` to show where the warning was created)
✔ it should fetch a planet named Mercury (1013ms)
✔ it should fetch a planet named Venus (86ms)
✔ it should fetch a planet named Earth (84ms)
✔ it should fetch a planet named Mars (88ms)
✔ it should fetch a planet named Jupiter (89ms)
✔ it should fetch a planet named Satrun (89ms)
✔ it should fetch a planet named Uranus (92ms)
✔ it should fetch a planet named Neptune (87ms)
Testing Other Endpoints
it should fetch OS Details
✔ it should fetch OS details
it should fetch Live Status
✔ it checks Liveness endpoint
it should fetch Ready Status
✔ it checks Readiness endpoint
11 passing (2s)
So things work very directly for me. The one thing to check is to make sure you actually have network access to the Atlas database, perhaps by using mongosh