Is Exercise Tracker Glitch template broken? Or am I missing something?

Hi all,

I’m a little confused by the exercise tracker template that I’m working with off of glitch. Right off the bat, it throws an error about the mongodb method used to open the connection being deprecated, and then says there’s an unhandled error.

It says nothing in the instructions about fixing this, nor can I really figure out how to. I tried adding a mongodb connection string in my process.env file, but that didn’t resolve it.

Any help here? Am i missing part of the assignment or is the template broken?

link to my glitch: https://glitch.com/edit/#!/complex-fixed-column

Error output:

(node:2783) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client

🐇🚨 Your app is listening on port 3000

events.js:160

      throw er; // Unhandled 'error' event

      ^

MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]

    at Pool.<anonymous> (/rbd/pnpm-volume/e82dc444-c10c-4122-9de2-86f8337a8e49/node_modules/.registry.npmjs.org/mongodb-core/2.1.18/node_modules/mongodb-core/lib/topologies/server.js:336:35)

    at emitOne (events.js:96:13)

    at Pool.emit (events.js:188:7)

    at Connection.<anonymous> (/rbd/pnpm-volume/e82dc444-c10c-4122-9de2-86f8337a8e49/node_modules/.registry.npmjs.org/mongodb-core/2.1.18/node_modules/mongodb-core/lib/connection/pool.js:280:12)

    at Connection.g (events.js:292:16)

    at emitTwo (events.js:106:13)

    at Connection.emit (events.js:191:7)

    at Socket.<anonymous> (/rbd/pnpm-volume/e82dc444-c10c-4122-9de2-86f8337a8e49/node_modules/.registry.npmjs.org/mongodb-core/2.1.18/node_modules/mongodb-core/lib/connection/connection.js:189:49)

    at Socket.g (events.js:292:16)

    at emitOne (events.js:96:13)

    at Socket.emit (events.js:188:7)

    at emitErrorNT (net.js:1290:8)

    at _combinedTickCallback (internal/process/next_tick.js:80:11)

    at process._tickCallback (internal/process/next_tick.js:104:9)
1 Like

I would check that your Mongo URI is correct.

According to the error the URL you’re using for MongoDB is locally hosted which you can’t use.
You have to signup for MongoDB Atlas and make a cluster there and then use it in glitch.

Also you’re not catching the error.

Thanks for the response. This is the default glitch template from FCC.

I have a MongoDB cluster, and have put the URI string in my process.env file, with the correct variable name, and i am still getting this error. I’ve also tried substituting the string directly in the code where its calling the mongo uri. No dice.

It’s worth noting that “events.js” (which is where it seems like the unhandled exception is) is not something that I am asked to edit in this exercise, nor have been asked to edit in any other FCC exercise, which is why I’m wondering if the template is problematic.

Please note: I have not looked over your solution, as of yet. However, there are a few lessons, and projects (exercise tracker included) being worked on. There are issues open on GitHub, as well as PRs on the way.

Sorry, for the inconvenience.

I also get an error as soon as I open the default glitch template from FCC in Glitch.

Trying to use the example app was quite difficult. I could create a user but adding an exercise was not possible with the form . The date format guidance says:

from, to = dates (yyyy-mm-dd); limit = number

but it sent back an error of :

Cast to Number failed for value “2020-05-27” at path “duration”

I wonder if it is just better to start an project from scratch or wait for this to be fixed.

1 Like

good call. I prefer doing these exercises in glitch because its just less stuff on my computer, but I suppose I could just use the test suite into a local project. To each their own, and that might be the only option rn!